
bin/kernel：     文件格式 elf32-i386


Disassembly of section .text:

c0100000 <kern_entry>:

.text
.globl kern_entry
kern_entry:
    # load pa of boot pgdir
    movl $REALLOC(__boot_pgdir), %eax
c0100000:	b8 00 90 12 00       	mov    $0x129000,%eax
    movl %eax, %cr3
c0100005:	0f 22 d8             	mov    %eax,%cr3

    # enable paging
    movl %cr0, %eax
c0100008:	0f 20 c0             	mov    %cr0,%eax
    orl $(CR0_PE | CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_TS | CR0_EM | CR0_MP), %eax
c010000b:	0d 2f 00 05 80       	or     $0x8005002f,%eax
    andl $~(CR0_TS | CR0_EM), %eax
c0100010:	83 e0 f3             	and    $0xfffffff3,%eax
    movl %eax, %cr0
c0100013:	0f 22 c0             	mov    %eax,%cr0

    # update eip
    # now, eip = 0x1.....
    leal next, %eax
c0100016:	8d 05 1e 00 10 c0    	lea    0xc010001e,%eax
    # set eip = KERNBASE + 0x1.....
    jmp *%eax
c010001c:	ff e0                	jmp    *%eax

c010001e <next>:
next:

    # unmap va 0 ~ 4M, it's temporary mapping
    xorl %eax, %eax
c010001e:	31 c0                	xor    %eax,%eax
    movl %eax, __boot_pgdir
c0100020:	a3 00 90 12 c0       	mov    %eax,0xc0129000

    # set ebp, esp
    movl $0x0, %ebp
c0100025:	bd 00 00 00 00       	mov    $0x0,%ebp
    # the kernel stack region is from bootstack -- bootstacktop,
    # the kernel stack size is KSTACKSIZE (8KB)defined in memlayout.h
    movl $bootstacktop, %esp
c010002a:	bc 00 80 12 c0       	mov    $0xc0128000,%esp
    # now kernel stack is ready , call the first C function
    call kern_init
c010002f:	e8 02 00 00 00       	call   c0100036 <kern_init>

c0100034 <spin>:

# should never get here
spin:
    jmp spin
c0100034:	eb fe                	jmp    c0100034 <spin>

c0100036 <kern_init>:
int kern_init(void) __attribute__((noreturn));
void grade_backtrace(void);
static void lab1_switch_test(void);

int
kern_init(void) {
c0100036:	f3 0f 1e fb          	endbr32 
c010003a:	55                   	push   %ebp
c010003b:	89 e5                	mov    %esp,%ebp
c010003d:	83 ec 28             	sub    $0x28,%esp
    extern char edata[], end[];
    memset(edata, 0, end - edata);
c0100040:	b8 58 e1 12 c0       	mov    $0xc012e158,%eax
c0100045:	2d 00 b0 12 c0       	sub    $0xc012b000,%eax
c010004a:	89 44 24 08          	mov    %eax,0x8(%esp)
c010004e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100055:	00 
c0100056:	c7 04 24 00 b0 12 c0 	movl   $0xc012b000,(%esp)
c010005d:	e8 d6 96 00 00       	call   c0109738 <memset>

    cons_init();                // init the console
c0100062:	e8 ca 1e 00 00       	call   c0101f31 <cons_init>

    const char *message = "(THU.CST) os is loading ...";
c0100067:	c7 45 f4 80 a0 10 c0 	movl   $0xc010a080,-0xc(%ebp)
    cprintf("%s\n\n", message);
c010006e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100071:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100075:	c7 04 24 9c a0 10 c0 	movl   $0xc010a09c,(%esp)
c010007c:	e8 50 02 00 00       	call   c01002d1 <cprintf>

    print_kerninfo();
c0100081:	e8 0e 09 00 00       	call   c0100994 <print_kerninfo>

    grade_backtrace();
c0100086:	e8 ac 00 00 00       	call   c0100137 <grade_backtrace>

    pmm_init();                 // init physical memory management
c010008b:	e8 98 3b 00 00       	call   c0103c28 <pmm_init>

    pic_init();                 // init interrupt controller
c0100090:	e8 17 20 00 00       	call   c01020ac <pic_init>
    idt_init();                 // init interrupt descriptor table
c0100095:	e8 bc 21 00 00       	call   c0102256 <idt_init>

    vmm_init();                 // init virtual memory management
c010009a:	e8 8f 56 00 00       	call   c010572e <vmm_init>
    proc_init();                // init process table
c010009f:	e8 1a 90 00 00       	call   c01090be <proc_init>
    
    ide_init();                 // init ide devices
c01000a4:	e8 bd 0d 00 00       	call   c0100e66 <ide_init>
    swap_init();                // init swap
c01000a9:	e8 96 67 00 00       	call   c0106844 <swap_init>

    clock_init();               // init clock interrupt
c01000ae:	e8 c5 15 00 00       	call   c0101678 <clock_init>
    intr_enable();              // enable irq interrupt
c01000b3:	e8 40 21 00 00       	call   c01021f8 <intr_enable>

    //LAB1: CAHLLENGE 1 If you try to do it, uncomment lab1_switch_test()
    // user/kernel mode switch test
    //lab1_switch_test();
    
    cpu_idle();                 // run idle process
c01000b8:	e8 c4 91 00 00       	call   c0109281 <cpu_idle>

c01000bd <grade_backtrace2>:
}

void __attribute__((noinline))
grade_backtrace2(int arg0, int arg1, int arg2, int arg3) {
c01000bd:	f3 0f 1e fb          	endbr32 
c01000c1:	55                   	push   %ebp
c01000c2:	89 e5                	mov    %esp,%ebp
c01000c4:	83 ec 18             	sub    $0x18,%esp
    mon_backtrace(0, NULL, NULL);
c01000c7:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01000ce:	00 
c01000cf:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01000d6:	00 
c01000d7:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01000de:	e8 10 0d 00 00       	call   c0100df3 <mon_backtrace>
}
c01000e3:	90                   	nop
c01000e4:	c9                   	leave  
c01000e5:	c3                   	ret    

c01000e6 <grade_backtrace1>:

void __attribute__((noinline))
grade_backtrace1(int arg0, int arg1) {
c01000e6:	f3 0f 1e fb          	endbr32 
c01000ea:	55                   	push   %ebp
c01000eb:	89 e5                	mov    %esp,%ebp
c01000ed:	53                   	push   %ebx
c01000ee:	83 ec 14             	sub    $0x14,%esp
    grade_backtrace2(arg0, (int)&arg0, arg1, (int)&arg1);
c01000f1:	8d 4d 0c             	lea    0xc(%ebp),%ecx
c01000f4:	8b 55 0c             	mov    0xc(%ebp),%edx
c01000f7:	8d 5d 08             	lea    0x8(%ebp),%ebx
c01000fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01000fd:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0100101:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100105:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0100109:	89 04 24             	mov    %eax,(%esp)
c010010c:	e8 ac ff ff ff       	call   c01000bd <grade_backtrace2>
}
c0100111:	90                   	nop
c0100112:	83 c4 14             	add    $0x14,%esp
c0100115:	5b                   	pop    %ebx
c0100116:	5d                   	pop    %ebp
c0100117:	c3                   	ret    

c0100118 <grade_backtrace0>:

void __attribute__((noinline))
grade_backtrace0(int arg0, int arg1, int arg2) {
c0100118:	f3 0f 1e fb          	endbr32 
c010011c:	55                   	push   %ebp
c010011d:	89 e5                	mov    %esp,%ebp
c010011f:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace1(arg0, arg2);
c0100122:	8b 45 10             	mov    0x10(%ebp),%eax
c0100125:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100129:	8b 45 08             	mov    0x8(%ebp),%eax
c010012c:	89 04 24             	mov    %eax,(%esp)
c010012f:	e8 b2 ff ff ff       	call   c01000e6 <grade_backtrace1>
}
c0100134:	90                   	nop
c0100135:	c9                   	leave  
c0100136:	c3                   	ret    

c0100137 <grade_backtrace>:

void
grade_backtrace(void) {
c0100137:	f3 0f 1e fb          	endbr32 
c010013b:	55                   	push   %ebp
c010013c:	89 e5                	mov    %esp,%ebp
c010013e:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace0(0, (int)kern_init, 0xffff0000);
c0100141:	b8 36 00 10 c0       	mov    $0xc0100036,%eax
c0100146:	c7 44 24 08 00 00 ff 	movl   $0xffff0000,0x8(%esp)
c010014d:	ff 
c010014e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100152:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0100159:	e8 ba ff ff ff       	call   c0100118 <grade_backtrace0>
}
c010015e:	90                   	nop
c010015f:	c9                   	leave  
c0100160:	c3                   	ret    

c0100161 <lab1_print_cur_status>:

static void
lab1_print_cur_status(void) {
c0100161:	f3 0f 1e fb          	endbr32 
c0100165:	55                   	push   %ebp
c0100166:	89 e5                	mov    %esp,%ebp
c0100168:	83 ec 28             	sub    $0x28,%esp
    static int round = 0;
    uint16_t reg1, reg2, reg3, reg4;
    asm volatile (
c010016b:	8c 4d f6             	mov    %cs,-0xa(%ebp)
c010016e:	8c 5d f4             	mov    %ds,-0xc(%ebp)
c0100171:	8c 45 f2             	mov    %es,-0xe(%ebp)
c0100174:	8c 55 f0             	mov    %ss,-0x10(%ebp)
            "mov %%cs, %0;"
            "mov %%ds, %1;"
            "mov %%es, %2;"
            "mov %%ss, %3;"
            : "=m"(reg1), "=m"(reg2), "=m"(reg3), "=m"(reg4));
    cprintf("%d: @ring %d\n", round, reg1 & 3);
c0100177:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010017b:	83 e0 03             	and    $0x3,%eax
c010017e:	89 c2                	mov    %eax,%edx
c0100180:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c0100185:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100189:	89 44 24 04          	mov    %eax,0x4(%esp)
c010018d:	c7 04 24 a1 a0 10 c0 	movl   $0xc010a0a1,(%esp)
c0100194:	e8 38 01 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  cs = %x\n", round, reg1);
c0100199:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010019d:	89 c2                	mov    %eax,%edx
c010019f:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c01001a4:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001a8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001ac:	c7 04 24 af a0 10 c0 	movl   $0xc010a0af,(%esp)
c01001b3:	e8 19 01 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  ds = %x\n", round, reg2);
c01001b8:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c01001bc:	89 c2                	mov    %eax,%edx
c01001be:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c01001c3:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001c7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001cb:	c7 04 24 bd a0 10 c0 	movl   $0xc010a0bd,(%esp)
c01001d2:	e8 fa 00 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  es = %x\n", round, reg3);
c01001d7:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01001db:	89 c2                	mov    %eax,%edx
c01001dd:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c01001e2:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001e6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001ea:	c7 04 24 cb a0 10 c0 	movl   $0xc010a0cb,(%esp)
c01001f1:	e8 db 00 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  ss = %x\n", round, reg4);
c01001f6:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c01001fa:	89 c2                	mov    %eax,%edx
c01001fc:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c0100201:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100205:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100209:	c7 04 24 d9 a0 10 c0 	movl   $0xc010a0d9,(%esp)
c0100210:	e8 bc 00 00 00       	call   c01002d1 <cprintf>
    round ++;
c0100215:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c010021a:	40                   	inc    %eax
c010021b:	a3 00 b0 12 c0       	mov    %eax,0xc012b000
}
c0100220:	90                   	nop
c0100221:	c9                   	leave  
c0100222:	c3                   	ret    

c0100223 <lab1_switch_to_user>:

static void
lab1_switch_to_user(void) {
c0100223:	f3 0f 1e fb          	endbr32 
c0100227:	55                   	push   %ebp
c0100228:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 : TODO
}
c010022a:	90                   	nop
c010022b:	5d                   	pop    %ebp
c010022c:	c3                   	ret    

c010022d <lab1_switch_to_kernel>:

static void
lab1_switch_to_kernel(void) {
c010022d:	f3 0f 1e fb          	endbr32 
c0100231:	55                   	push   %ebp
c0100232:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 :  TODO
}
c0100234:	90                   	nop
c0100235:	5d                   	pop    %ebp
c0100236:	c3                   	ret    

c0100237 <lab1_switch_test>:

static void
lab1_switch_test(void) {
c0100237:	f3 0f 1e fb          	endbr32 
c010023b:	55                   	push   %ebp
c010023c:	89 e5                	mov    %esp,%ebp
c010023e:	83 ec 18             	sub    $0x18,%esp
    lab1_print_cur_status();
c0100241:	e8 1b ff ff ff       	call   c0100161 <lab1_print_cur_status>
    cprintf("+++ switch to  user  mode +++\n");
c0100246:	c7 04 24 e8 a0 10 c0 	movl   $0xc010a0e8,(%esp)
c010024d:	e8 7f 00 00 00       	call   c01002d1 <cprintf>
    lab1_switch_to_user();
c0100252:	e8 cc ff ff ff       	call   c0100223 <lab1_switch_to_user>
    lab1_print_cur_status();
c0100257:	e8 05 ff ff ff       	call   c0100161 <lab1_print_cur_status>
    cprintf("+++ switch to kernel mode +++\n");
c010025c:	c7 04 24 08 a1 10 c0 	movl   $0xc010a108,(%esp)
c0100263:	e8 69 00 00 00       	call   c01002d1 <cprintf>
    lab1_switch_to_kernel();
c0100268:	e8 c0 ff ff ff       	call   c010022d <lab1_switch_to_kernel>
    lab1_print_cur_status();
c010026d:	e8 ef fe ff ff       	call   c0100161 <lab1_print_cur_status>
}
c0100272:	90                   	nop
c0100273:	c9                   	leave  
c0100274:	c3                   	ret    

c0100275 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void
cputch(int c, int *cnt) {
c0100275:	f3 0f 1e fb          	endbr32 
c0100279:	55                   	push   %ebp
c010027a:	89 e5                	mov    %esp,%ebp
c010027c:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c010027f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100282:	89 04 24             	mov    %eax,(%esp)
c0100285:	e8 d8 1c 00 00       	call   c0101f62 <cons_putc>
    (*cnt) ++;
c010028a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010028d:	8b 00                	mov    (%eax),%eax
c010028f:	8d 50 01             	lea    0x1(%eax),%edx
c0100292:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100295:	89 10                	mov    %edx,(%eax)
}
c0100297:	90                   	nop
c0100298:	c9                   	leave  
c0100299:	c3                   	ret    

c010029a <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int
vcprintf(const char *fmt, va_list ap) {
c010029a:	f3 0f 1e fb          	endbr32 
c010029e:	55                   	push   %ebp
c010029f:	89 e5                	mov    %esp,%ebp
c01002a1:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c01002a4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)cputch, &cnt, fmt, ap);
c01002ab:	8b 45 0c             	mov    0xc(%ebp),%eax
c01002ae:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01002b2:	8b 45 08             	mov    0x8(%ebp),%eax
c01002b5:	89 44 24 08          	mov    %eax,0x8(%esp)
c01002b9:	8d 45 f4             	lea    -0xc(%ebp),%eax
c01002bc:	89 44 24 04          	mov    %eax,0x4(%esp)
c01002c0:	c7 04 24 75 02 10 c0 	movl   $0xc0100275,(%esp)
c01002c7:	e8 d8 97 00 00       	call   c0109aa4 <vprintfmt>
    return cnt;
c01002cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01002cf:	c9                   	leave  
c01002d0:	c3                   	ret    

c01002d1 <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int
cprintf(const char *fmt, ...) {
c01002d1:	f3 0f 1e fb          	endbr32 
c01002d5:	55                   	push   %ebp
c01002d6:	89 e5                	mov    %esp,%ebp
c01002d8:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c01002db:	8d 45 0c             	lea    0xc(%ebp),%eax
c01002de:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vcprintf(fmt, ap);
c01002e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01002e4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01002e8:	8b 45 08             	mov    0x8(%ebp),%eax
c01002eb:	89 04 24             	mov    %eax,(%esp)
c01002ee:	e8 a7 ff ff ff       	call   c010029a <vcprintf>
c01002f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c01002f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01002f9:	c9                   	leave  
c01002fa:	c3                   	ret    

c01002fb <cputchar>:

/* cputchar - writes a single character to stdout */
void
cputchar(int c) {
c01002fb:	f3 0f 1e fb          	endbr32 
c01002ff:	55                   	push   %ebp
c0100300:	89 e5                	mov    %esp,%ebp
c0100302:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c0100305:	8b 45 08             	mov    0x8(%ebp),%eax
c0100308:	89 04 24             	mov    %eax,(%esp)
c010030b:	e8 52 1c 00 00       	call   c0101f62 <cons_putc>
}
c0100310:	90                   	nop
c0100311:	c9                   	leave  
c0100312:	c3                   	ret    

c0100313 <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int
cputs(const char *str) {
c0100313:	f3 0f 1e fb          	endbr32 
c0100317:	55                   	push   %ebp
c0100318:	89 e5                	mov    %esp,%ebp
c010031a:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c010031d:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    char c;
    while ((c = *str ++) != '\0') {
c0100324:	eb 13                	jmp    c0100339 <cputs+0x26>
        cputch(c, &cnt);
c0100326:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c010032a:	8d 55 f0             	lea    -0x10(%ebp),%edx
c010032d:	89 54 24 04          	mov    %edx,0x4(%esp)
c0100331:	89 04 24             	mov    %eax,(%esp)
c0100334:	e8 3c ff ff ff       	call   c0100275 <cputch>
    while ((c = *str ++) != '\0') {
c0100339:	8b 45 08             	mov    0x8(%ebp),%eax
c010033c:	8d 50 01             	lea    0x1(%eax),%edx
c010033f:	89 55 08             	mov    %edx,0x8(%ebp)
c0100342:	0f b6 00             	movzbl (%eax),%eax
c0100345:	88 45 f7             	mov    %al,-0x9(%ebp)
c0100348:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
c010034c:	75 d8                	jne    c0100326 <cputs+0x13>
    }
    cputch('\n', &cnt);
c010034e:	8d 45 f0             	lea    -0x10(%ebp),%eax
c0100351:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100355:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
c010035c:	e8 14 ff ff ff       	call   c0100275 <cputch>
    return cnt;
c0100361:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0100364:	c9                   	leave  
c0100365:	c3                   	ret    

c0100366 <getchar>:

/* getchar - reads a single non-zero character from stdin */
int
getchar(void) {
c0100366:	f3 0f 1e fb          	endbr32 
c010036a:	55                   	push   %ebp
c010036b:	89 e5                	mov    %esp,%ebp
c010036d:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = cons_getc()) == 0)
c0100370:	90                   	nop
c0100371:	e8 2d 1c 00 00       	call   c0101fa3 <cons_getc>
c0100376:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100379:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010037d:	74 f2                	je     c0100371 <getchar+0xb>
        /* do nothing */;
    return c;
c010037f:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100382:	c9                   	leave  
c0100383:	c3                   	ret    

c0100384 <readline>:
 * The readline() function returns the text of the line read. If some errors
 * are happened, NULL is returned. The return value is a global variable,
 * thus it should be copied before it is used.
 * */
char *
readline(const char *prompt) {
c0100384:	f3 0f 1e fb          	endbr32 
c0100388:	55                   	push   %ebp
c0100389:	89 e5                	mov    %esp,%ebp
c010038b:	83 ec 28             	sub    $0x28,%esp
    if (prompt != NULL) {
c010038e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100392:	74 13                	je     c01003a7 <readline+0x23>
        cprintf("%s", prompt);
c0100394:	8b 45 08             	mov    0x8(%ebp),%eax
c0100397:	89 44 24 04          	mov    %eax,0x4(%esp)
c010039b:	c7 04 24 27 a1 10 c0 	movl   $0xc010a127,(%esp)
c01003a2:	e8 2a ff ff ff       	call   c01002d1 <cprintf>
    }
    int i = 0, c;
c01003a7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        c = getchar();
c01003ae:	e8 b3 ff ff ff       	call   c0100366 <getchar>
c01003b3:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (c < 0) {
c01003b6:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01003ba:	79 07                	jns    c01003c3 <readline+0x3f>
            return NULL;
c01003bc:	b8 00 00 00 00       	mov    $0x0,%eax
c01003c1:	eb 78                	jmp    c010043b <readline+0xb7>
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
c01003c3:	83 7d f0 1f          	cmpl   $0x1f,-0x10(%ebp)
c01003c7:	7e 28                	jle    c01003f1 <readline+0x6d>
c01003c9:	81 7d f4 fe 03 00 00 	cmpl   $0x3fe,-0xc(%ebp)
c01003d0:	7f 1f                	jg     c01003f1 <readline+0x6d>
            cputchar(c);
c01003d2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01003d5:	89 04 24             	mov    %eax,(%esp)
c01003d8:	e8 1e ff ff ff       	call   c01002fb <cputchar>
            buf[i ++] = c;
c01003dd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01003e0:	8d 50 01             	lea    0x1(%eax),%edx
c01003e3:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01003e6:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01003e9:	88 90 20 b0 12 c0    	mov    %dl,-0x3fed4fe0(%eax)
c01003ef:	eb 45                	jmp    c0100436 <readline+0xb2>
        }
        else if (c == '\b' && i > 0) {
c01003f1:	83 7d f0 08          	cmpl   $0x8,-0x10(%ebp)
c01003f5:	75 16                	jne    c010040d <readline+0x89>
c01003f7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01003fb:	7e 10                	jle    c010040d <readline+0x89>
            cputchar(c);
c01003fd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100400:	89 04 24             	mov    %eax,(%esp)
c0100403:	e8 f3 fe ff ff       	call   c01002fb <cputchar>
            i --;
c0100408:	ff 4d f4             	decl   -0xc(%ebp)
c010040b:	eb 29                	jmp    c0100436 <readline+0xb2>
        }
        else if (c == '\n' || c == '\r') {
c010040d:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
c0100411:	74 06                	je     c0100419 <readline+0x95>
c0100413:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
c0100417:	75 95                	jne    c01003ae <readline+0x2a>
            cputchar(c);
c0100419:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010041c:	89 04 24             	mov    %eax,(%esp)
c010041f:	e8 d7 fe ff ff       	call   c01002fb <cputchar>
            buf[i] = '\0';
c0100424:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100427:	05 20 b0 12 c0       	add    $0xc012b020,%eax
c010042c:	c6 00 00             	movb   $0x0,(%eax)
            return buf;
c010042f:	b8 20 b0 12 c0       	mov    $0xc012b020,%eax
c0100434:	eb 05                	jmp    c010043b <readline+0xb7>
        c = getchar();
c0100436:	e9 73 ff ff ff       	jmp    c01003ae <readline+0x2a>
        }
    }
}
c010043b:	c9                   	leave  
c010043c:	c3                   	ret    

c010043d <__panic>:
/* *
 * __panic - __panic is called on unresolvable fatal errors. it prints
 * "panic: 'message'", and then enters the kernel monitor.
 * */
void
__panic(const char *file, int line, const char *fmt, ...) {
c010043d:	f3 0f 1e fb          	endbr32 
c0100441:	55                   	push   %ebp
c0100442:	89 e5                	mov    %esp,%ebp
c0100444:	83 ec 28             	sub    $0x28,%esp
    if (is_panic) {
c0100447:	a1 20 b4 12 c0       	mov    0xc012b420,%eax
c010044c:	85 c0                	test   %eax,%eax
c010044e:	75 5b                	jne    c01004ab <__panic+0x6e>
        goto panic_dead;
    }
    is_panic = 1;
c0100450:	c7 05 20 b4 12 c0 01 	movl   $0x1,0xc012b420
c0100457:	00 00 00 

    // print the 'message'
    va_list ap;
    va_start(ap, fmt);
c010045a:	8d 45 14             	lea    0x14(%ebp),%eax
c010045d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel panic at %s:%d:\n    ", file, line);
c0100460:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100463:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100467:	8b 45 08             	mov    0x8(%ebp),%eax
c010046a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010046e:	c7 04 24 2a a1 10 c0 	movl   $0xc010a12a,(%esp)
c0100475:	e8 57 fe ff ff       	call   c01002d1 <cprintf>
    vcprintf(fmt, ap);
c010047a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010047d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100481:	8b 45 10             	mov    0x10(%ebp),%eax
c0100484:	89 04 24             	mov    %eax,(%esp)
c0100487:	e8 0e fe ff ff       	call   c010029a <vcprintf>
    cprintf("\n");
c010048c:	c7 04 24 46 a1 10 c0 	movl   $0xc010a146,(%esp)
c0100493:	e8 39 fe ff ff       	call   c01002d1 <cprintf>
    
    cprintf("stack trackback:\n");
c0100498:	c7 04 24 48 a1 10 c0 	movl   $0xc010a148,(%esp)
c010049f:	e8 2d fe ff ff       	call   c01002d1 <cprintf>
    print_stackframe();
c01004a4:	e8 3d 06 00 00       	call   c0100ae6 <print_stackframe>
c01004a9:	eb 01                	jmp    c01004ac <__panic+0x6f>
        goto panic_dead;
c01004ab:	90                   	nop
    
    va_end(ap);

panic_dead:
    intr_disable();
c01004ac:	e8 53 1d 00 00       	call   c0102204 <intr_disable>
    while (1) {
        kmonitor(NULL);
c01004b1:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01004b8:	e8 5d 08 00 00       	call   c0100d1a <kmonitor>
c01004bd:	eb f2                	jmp    c01004b1 <__panic+0x74>

c01004bf <__warn>:
    }
}

/* __warn - like panic, but don't */
void
__warn(const char *file, int line, const char *fmt, ...) {
c01004bf:	f3 0f 1e fb          	endbr32 
c01004c3:	55                   	push   %ebp
c01004c4:	89 e5                	mov    %esp,%ebp
c01004c6:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    va_start(ap, fmt);
c01004c9:	8d 45 14             	lea    0x14(%ebp),%eax
c01004cc:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel warning at %s:%d:\n    ", file, line);
c01004cf:	8b 45 0c             	mov    0xc(%ebp),%eax
c01004d2:	89 44 24 08          	mov    %eax,0x8(%esp)
c01004d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01004d9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01004dd:	c7 04 24 5a a1 10 c0 	movl   $0xc010a15a,(%esp)
c01004e4:	e8 e8 fd ff ff       	call   c01002d1 <cprintf>
    vcprintf(fmt, ap);
c01004e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01004ec:	89 44 24 04          	mov    %eax,0x4(%esp)
c01004f0:	8b 45 10             	mov    0x10(%ebp),%eax
c01004f3:	89 04 24             	mov    %eax,(%esp)
c01004f6:	e8 9f fd ff ff       	call   c010029a <vcprintf>
    cprintf("\n");
c01004fb:	c7 04 24 46 a1 10 c0 	movl   $0xc010a146,(%esp)
c0100502:	e8 ca fd ff ff       	call   c01002d1 <cprintf>
    va_end(ap);
}
c0100507:	90                   	nop
c0100508:	c9                   	leave  
c0100509:	c3                   	ret    

c010050a <is_kernel_panic>:

bool
is_kernel_panic(void) {
c010050a:	f3 0f 1e fb          	endbr32 
c010050e:	55                   	push   %ebp
c010050f:	89 e5                	mov    %esp,%ebp
    return is_panic;
c0100511:	a1 20 b4 12 c0       	mov    0xc012b420,%eax
}
c0100516:	5d                   	pop    %ebp
c0100517:	c3                   	ret    

c0100518 <stab_binsearch>:
 *      stab_binsearch(stabs, &left, &right, N_SO, 0xf0100184);
 * will exit setting left = 118, right = 554.
 * */
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
c0100518:	f3 0f 1e fb          	endbr32 
c010051c:	55                   	push   %ebp
c010051d:	89 e5                	mov    %esp,%ebp
c010051f:	83 ec 20             	sub    $0x20,%esp
    int l = *region_left, r = *region_right, any_matches = 0;
c0100522:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100525:	8b 00                	mov    (%eax),%eax
c0100527:	89 45 fc             	mov    %eax,-0x4(%ebp)
c010052a:	8b 45 10             	mov    0x10(%ebp),%eax
c010052d:	8b 00                	mov    (%eax),%eax
c010052f:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0100532:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

    while (l <= r) {
c0100539:	e9 ca 00 00 00       	jmp    c0100608 <stab_binsearch+0xf0>
        int true_m = (l + r) / 2, m = true_m;
c010053e:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100541:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100544:	01 d0                	add    %edx,%eax
c0100546:	89 c2                	mov    %eax,%edx
c0100548:	c1 ea 1f             	shr    $0x1f,%edx
c010054b:	01 d0                	add    %edx,%eax
c010054d:	d1 f8                	sar    %eax
c010054f:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100552:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100555:	89 45 f0             	mov    %eax,-0x10(%ebp)

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c0100558:	eb 03                	jmp    c010055d <stab_binsearch+0x45>
            m --;
c010055a:	ff 4d f0             	decl   -0x10(%ebp)
        while (m >= l && stabs[m].n_type != type) {
c010055d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100560:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100563:	7c 1f                	jl     c0100584 <stab_binsearch+0x6c>
c0100565:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100568:	89 d0                	mov    %edx,%eax
c010056a:	01 c0                	add    %eax,%eax
c010056c:	01 d0                	add    %edx,%eax
c010056e:	c1 e0 02             	shl    $0x2,%eax
c0100571:	89 c2                	mov    %eax,%edx
c0100573:	8b 45 08             	mov    0x8(%ebp),%eax
c0100576:	01 d0                	add    %edx,%eax
c0100578:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c010057c:	0f b6 c0             	movzbl %al,%eax
c010057f:	39 45 14             	cmp    %eax,0x14(%ebp)
c0100582:	75 d6                	jne    c010055a <stab_binsearch+0x42>
        }
        if (m < l) {    // no match in [l, m]
c0100584:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100587:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c010058a:	7d 09                	jge    c0100595 <stab_binsearch+0x7d>
            l = true_m + 1;
c010058c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010058f:	40                   	inc    %eax
c0100590:	89 45 fc             	mov    %eax,-0x4(%ebp)
            continue;
c0100593:	eb 73                	jmp    c0100608 <stab_binsearch+0xf0>
        }

        // actual binary search
        any_matches = 1;
c0100595:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
        if (stabs[m].n_value < addr) {
c010059c:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010059f:	89 d0                	mov    %edx,%eax
c01005a1:	01 c0                	add    %eax,%eax
c01005a3:	01 d0                	add    %edx,%eax
c01005a5:	c1 e0 02             	shl    $0x2,%eax
c01005a8:	89 c2                	mov    %eax,%edx
c01005aa:	8b 45 08             	mov    0x8(%ebp),%eax
c01005ad:	01 d0                	add    %edx,%eax
c01005af:	8b 40 08             	mov    0x8(%eax),%eax
c01005b2:	39 45 18             	cmp    %eax,0x18(%ebp)
c01005b5:	76 11                	jbe    c01005c8 <stab_binsearch+0xb0>
            *region_left = m;
c01005b7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01005ba:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005bd:	89 10                	mov    %edx,(%eax)
            l = true_m + 1;
c01005bf:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01005c2:	40                   	inc    %eax
c01005c3:	89 45 fc             	mov    %eax,-0x4(%ebp)
c01005c6:	eb 40                	jmp    c0100608 <stab_binsearch+0xf0>
        } else if (stabs[m].n_value > addr) {
c01005c8:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005cb:	89 d0                	mov    %edx,%eax
c01005cd:	01 c0                	add    %eax,%eax
c01005cf:	01 d0                	add    %edx,%eax
c01005d1:	c1 e0 02             	shl    $0x2,%eax
c01005d4:	89 c2                	mov    %eax,%edx
c01005d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01005d9:	01 d0                	add    %edx,%eax
c01005db:	8b 40 08             	mov    0x8(%eax),%eax
c01005de:	39 45 18             	cmp    %eax,0x18(%ebp)
c01005e1:	73 14                	jae    c01005f7 <stab_binsearch+0xdf>
            *region_right = m - 1;
c01005e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005e6:	8d 50 ff             	lea    -0x1(%eax),%edx
c01005e9:	8b 45 10             	mov    0x10(%ebp),%eax
c01005ec:	89 10                	mov    %edx,(%eax)
            r = m - 1;
c01005ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005f1:	48                   	dec    %eax
c01005f2:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01005f5:	eb 11                	jmp    c0100608 <stab_binsearch+0xf0>
        } else {
            // exact match for 'addr', but continue loop to find
            // *region_right
            *region_left = m;
c01005f7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01005fa:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005fd:	89 10                	mov    %edx,(%eax)
            l = m;
c01005ff:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100602:	89 45 fc             	mov    %eax,-0x4(%ebp)
            addr ++;
c0100605:	ff 45 18             	incl   0x18(%ebp)
    while (l <= r) {
c0100608:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010060b:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c010060e:	0f 8e 2a ff ff ff    	jle    c010053e <stab_binsearch+0x26>
        }
    }

    if (!any_matches) {
c0100614:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100618:	75 0f                	jne    c0100629 <stab_binsearch+0x111>
        *region_right = *region_left - 1;
c010061a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010061d:	8b 00                	mov    (%eax),%eax
c010061f:	8d 50 ff             	lea    -0x1(%eax),%edx
c0100622:	8b 45 10             	mov    0x10(%ebp),%eax
c0100625:	89 10                	mov    %edx,(%eax)
        l = *region_right;
        for (; l > *region_left && stabs[l].n_type != type; l --)
            /* do nothing */;
        *region_left = l;
    }
}
c0100627:	eb 3e                	jmp    c0100667 <stab_binsearch+0x14f>
        l = *region_right;
c0100629:	8b 45 10             	mov    0x10(%ebp),%eax
c010062c:	8b 00                	mov    (%eax),%eax
c010062e:	89 45 fc             	mov    %eax,-0x4(%ebp)
        for (; l > *region_left && stabs[l].n_type != type; l --)
c0100631:	eb 03                	jmp    c0100636 <stab_binsearch+0x11e>
c0100633:	ff 4d fc             	decl   -0x4(%ebp)
c0100636:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100639:	8b 00                	mov    (%eax),%eax
c010063b:	39 45 fc             	cmp    %eax,-0x4(%ebp)
c010063e:	7e 1f                	jle    c010065f <stab_binsearch+0x147>
c0100640:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100643:	89 d0                	mov    %edx,%eax
c0100645:	01 c0                	add    %eax,%eax
c0100647:	01 d0                	add    %edx,%eax
c0100649:	c1 e0 02             	shl    $0x2,%eax
c010064c:	89 c2                	mov    %eax,%edx
c010064e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100651:	01 d0                	add    %edx,%eax
c0100653:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100657:	0f b6 c0             	movzbl %al,%eax
c010065a:	39 45 14             	cmp    %eax,0x14(%ebp)
c010065d:	75 d4                	jne    c0100633 <stab_binsearch+0x11b>
        *region_left = l;
c010065f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100662:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100665:	89 10                	mov    %edx,(%eax)
}
c0100667:	90                   	nop
c0100668:	c9                   	leave  
c0100669:	c3                   	ret    

c010066a <debuginfo_eip>:
 * the specified instruction address, @addr.  Returns 0 if information
 * was found, and negative if not.  But even if it returns negative it
 * has stored some information into '*info'.
 * */
int
debuginfo_eip(uintptr_t addr, struct eipdebuginfo *info) {
c010066a:	f3 0f 1e fb          	endbr32 
c010066e:	55                   	push   %ebp
c010066f:	89 e5                	mov    %esp,%ebp
c0100671:	83 ec 58             	sub    $0x58,%esp
    const struct stab *stabs, *stab_end;
    const char *stabstr, *stabstr_end;

    info->eip_file = "<unknown>";
c0100674:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100677:	c7 00 78 a1 10 c0    	movl   $0xc010a178,(%eax)
    info->eip_line = 0;
c010067d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100680:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    info->eip_fn_name = "<unknown>";
c0100687:	8b 45 0c             	mov    0xc(%ebp),%eax
c010068a:	c7 40 08 78 a1 10 c0 	movl   $0xc010a178,0x8(%eax)
    info->eip_fn_namelen = 9;
c0100691:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100694:	c7 40 0c 09 00 00 00 	movl   $0x9,0xc(%eax)
    info->eip_fn_addr = addr;
c010069b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010069e:	8b 55 08             	mov    0x8(%ebp),%edx
c01006a1:	89 50 10             	mov    %edx,0x10(%eax)
    info->eip_fn_narg = 0;
c01006a4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006a7:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)

    stabs = __STAB_BEGIN__;
c01006ae:	c7 45 f4 64 c3 10 c0 	movl   $0xc010c364,-0xc(%ebp)
    stab_end = __STAB_END__;
c01006b5:	c7 45 f0 44 0c 12 c0 	movl   $0xc0120c44,-0x10(%ebp)
    stabstr = __STABSTR_BEGIN__;
c01006bc:	c7 45 ec 45 0c 12 c0 	movl   $0xc0120c45,-0x14(%ebp)
    stabstr_end = __STABSTR_END__;
c01006c3:	c7 45 e8 5a 55 12 c0 	movl   $0xc012555a,-0x18(%ebp)

    // String table validity checks
    if (stabstr_end <= stabstr || stabstr_end[-1] != 0) {
c01006ca:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01006cd:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01006d0:	76 0b                	jbe    c01006dd <debuginfo_eip+0x73>
c01006d2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01006d5:	48                   	dec    %eax
c01006d6:	0f b6 00             	movzbl (%eax),%eax
c01006d9:	84 c0                	test   %al,%al
c01006db:	74 0a                	je     c01006e7 <debuginfo_eip+0x7d>
        return -1;
c01006dd:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01006e2:	e9 ab 02 00 00       	jmp    c0100992 <debuginfo_eip+0x328>
    // 'eip'.  First, we find the basic source file containing 'eip'.
    // Then, we look in that source file for the function.  Then we look
    // for the line number.

    // Search the entire set of stabs for the source file (type N_SO).
    int lfile = 0, rfile = (stab_end - stabs) - 1;
c01006e7:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
c01006ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01006f1:	2b 45 f4             	sub    -0xc(%ebp),%eax
c01006f4:	c1 f8 02             	sar    $0x2,%eax
c01006f7:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
c01006fd:	48                   	dec    %eax
c01006fe:	89 45 e0             	mov    %eax,-0x20(%ebp)
    stab_binsearch(stabs, &lfile, &rfile, N_SO, addr);
c0100701:	8b 45 08             	mov    0x8(%ebp),%eax
c0100704:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100708:	c7 44 24 0c 64 00 00 	movl   $0x64,0xc(%esp)
c010070f:	00 
c0100710:	8d 45 e0             	lea    -0x20(%ebp),%eax
c0100713:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100717:	8d 45 e4             	lea    -0x1c(%ebp),%eax
c010071a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010071e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100721:	89 04 24             	mov    %eax,(%esp)
c0100724:	e8 ef fd ff ff       	call   c0100518 <stab_binsearch>
    if (lfile == 0)
c0100729:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010072c:	85 c0                	test   %eax,%eax
c010072e:	75 0a                	jne    c010073a <debuginfo_eip+0xd0>
        return -1;
c0100730:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100735:	e9 58 02 00 00       	jmp    c0100992 <debuginfo_eip+0x328>

    // Search within that file's stabs for the function definition
    // (N_FUN).
    int lfun = lfile, rfun = rfile;
c010073a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010073d:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0100740:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100743:	89 45 d8             	mov    %eax,-0x28(%ebp)
    int lline, rline;
    stab_binsearch(stabs, &lfun, &rfun, N_FUN, addr);
c0100746:	8b 45 08             	mov    0x8(%ebp),%eax
c0100749:	89 44 24 10          	mov    %eax,0x10(%esp)
c010074d:	c7 44 24 0c 24 00 00 	movl   $0x24,0xc(%esp)
c0100754:	00 
c0100755:	8d 45 d8             	lea    -0x28(%ebp),%eax
c0100758:	89 44 24 08          	mov    %eax,0x8(%esp)
c010075c:	8d 45 dc             	lea    -0x24(%ebp),%eax
c010075f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100763:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100766:	89 04 24             	mov    %eax,(%esp)
c0100769:	e8 aa fd ff ff       	call   c0100518 <stab_binsearch>

    if (lfun <= rfun) {
c010076e:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0100771:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100774:	39 c2                	cmp    %eax,%edx
c0100776:	7f 78                	jg     c01007f0 <debuginfo_eip+0x186>
        // stabs[lfun] points to the function name
        // in the string table, but check bounds just in case.
        if (stabs[lfun].n_strx < stabstr_end - stabstr) {
c0100778:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010077b:	89 c2                	mov    %eax,%edx
c010077d:	89 d0                	mov    %edx,%eax
c010077f:	01 c0                	add    %eax,%eax
c0100781:	01 d0                	add    %edx,%eax
c0100783:	c1 e0 02             	shl    $0x2,%eax
c0100786:	89 c2                	mov    %eax,%edx
c0100788:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010078b:	01 d0                	add    %edx,%eax
c010078d:	8b 10                	mov    (%eax),%edx
c010078f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100792:	2b 45 ec             	sub    -0x14(%ebp),%eax
c0100795:	39 c2                	cmp    %eax,%edx
c0100797:	73 22                	jae    c01007bb <debuginfo_eip+0x151>
            info->eip_fn_name = stabstr + stabs[lfun].n_strx;
c0100799:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010079c:	89 c2                	mov    %eax,%edx
c010079e:	89 d0                	mov    %edx,%eax
c01007a0:	01 c0                	add    %eax,%eax
c01007a2:	01 d0                	add    %edx,%eax
c01007a4:	c1 e0 02             	shl    $0x2,%eax
c01007a7:	89 c2                	mov    %eax,%edx
c01007a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007ac:	01 d0                	add    %edx,%eax
c01007ae:	8b 10                	mov    (%eax),%edx
c01007b0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01007b3:	01 c2                	add    %eax,%edx
c01007b5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007b8:	89 50 08             	mov    %edx,0x8(%eax)
        }
        info->eip_fn_addr = stabs[lfun].n_value;
c01007bb:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01007be:	89 c2                	mov    %eax,%edx
c01007c0:	89 d0                	mov    %edx,%eax
c01007c2:	01 c0                	add    %eax,%eax
c01007c4:	01 d0                	add    %edx,%eax
c01007c6:	c1 e0 02             	shl    $0x2,%eax
c01007c9:	89 c2                	mov    %eax,%edx
c01007cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007ce:	01 d0                	add    %edx,%eax
c01007d0:	8b 50 08             	mov    0x8(%eax),%edx
c01007d3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007d6:	89 50 10             	mov    %edx,0x10(%eax)
        addr -= info->eip_fn_addr;
c01007d9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007dc:	8b 40 10             	mov    0x10(%eax),%eax
c01007df:	29 45 08             	sub    %eax,0x8(%ebp)
        // Search within the function definition for the line number.
        lline = lfun;
c01007e2:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01007e5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfun;
c01007e8:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01007eb:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01007ee:	eb 15                	jmp    c0100805 <debuginfo_eip+0x19b>
    } else {
        // Couldn't find function stab!  Maybe we're in an assembly
        // file.  Search the whole file for the line number.
        info->eip_fn_addr = addr;
c01007f0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007f3:	8b 55 08             	mov    0x8(%ebp),%edx
c01007f6:	89 50 10             	mov    %edx,0x10(%eax)
        lline = lfile;
c01007f9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01007fc:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfile;
c01007ff:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100802:	89 45 d0             	mov    %eax,-0x30(%ebp)
    }
    info->eip_fn_namelen = strfind(info->eip_fn_name, ':') - info->eip_fn_name;
c0100805:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100808:	8b 40 08             	mov    0x8(%eax),%eax
c010080b:	c7 44 24 04 3a 00 00 	movl   $0x3a,0x4(%esp)
c0100812:	00 
c0100813:	89 04 24             	mov    %eax,(%esp)
c0100816:	e8 91 8d 00 00       	call   c01095ac <strfind>
c010081b:	8b 55 0c             	mov    0xc(%ebp),%edx
c010081e:	8b 52 08             	mov    0x8(%edx),%edx
c0100821:	29 d0                	sub    %edx,%eax
c0100823:	89 c2                	mov    %eax,%edx
c0100825:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100828:	89 50 0c             	mov    %edx,0xc(%eax)

    // Search within [lline, rline] for the line number stab.
    // If found, set info->eip_line to the right line number.
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
c010082b:	8b 45 08             	mov    0x8(%ebp),%eax
c010082e:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100832:	c7 44 24 0c 44 00 00 	movl   $0x44,0xc(%esp)
c0100839:	00 
c010083a:	8d 45 d0             	lea    -0x30(%ebp),%eax
c010083d:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100841:	8d 45 d4             	lea    -0x2c(%ebp),%eax
c0100844:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100848:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010084b:	89 04 24             	mov    %eax,(%esp)
c010084e:	e8 c5 fc ff ff       	call   c0100518 <stab_binsearch>
    if (lline <= rline) {
c0100853:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100856:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100859:	39 c2                	cmp    %eax,%edx
c010085b:	7f 23                	jg     c0100880 <debuginfo_eip+0x216>
        info->eip_line = stabs[rline].n_desc;
c010085d:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100860:	89 c2                	mov    %eax,%edx
c0100862:	89 d0                	mov    %edx,%eax
c0100864:	01 c0                	add    %eax,%eax
c0100866:	01 d0                	add    %edx,%eax
c0100868:	c1 e0 02             	shl    $0x2,%eax
c010086b:	89 c2                	mov    %eax,%edx
c010086d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100870:	01 d0                	add    %edx,%eax
c0100872:	0f b7 40 06          	movzwl 0x6(%eax),%eax
c0100876:	89 c2                	mov    %eax,%edx
c0100878:	8b 45 0c             	mov    0xc(%ebp),%eax
c010087b:	89 50 04             	mov    %edx,0x4(%eax)

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c010087e:	eb 11                	jmp    c0100891 <debuginfo_eip+0x227>
        return -1;
c0100880:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100885:	e9 08 01 00 00       	jmp    c0100992 <debuginfo_eip+0x328>
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
        lline --;
c010088a:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010088d:	48                   	dec    %eax
c010088e:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    while (lline >= lfile
c0100891:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100894:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100897:	39 c2                	cmp    %eax,%edx
c0100899:	7c 56                	jl     c01008f1 <debuginfo_eip+0x287>
           && stabs[lline].n_type != N_SOL
c010089b:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010089e:	89 c2                	mov    %eax,%edx
c01008a0:	89 d0                	mov    %edx,%eax
c01008a2:	01 c0                	add    %eax,%eax
c01008a4:	01 d0                	add    %edx,%eax
c01008a6:	c1 e0 02             	shl    $0x2,%eax
c01008a9:	89 c2                	mov    %eax,%edx
c01008ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008ae:	01 d0                	add    %edx,%eax
c01008b0:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01008b4:	3c 84                	cmp    $0x84,%al
c01008b6:	74 39                	je     c01008f1 <debuginfo_eip+0x287>
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
c01008b8:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01008bb:	89 c2                	mov    %eax,%edx
c01008bd:	89 d0                	mov    %edx,%eax
c01008bf:	01 c0                	add    %eax,%eax
c01008c1:	01 d0                	add    %edx,%eax
c01008c3:	c1 e0 02             	shl    $0x2,%eax
c01008c6:	89 c2                	mov    %eax,%edx
c01008c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008cb:	01 d0                	add    %edx,%eax
c01008cd:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01008d1:	3c 64                	cmp    $0x64,%al
c01008d3:	75 b5                	jne    c010088a <debuginfo_eip+0x220>
c01008d5:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01008d8:	89 c2                	mov    %eax,%edx
c01008da:	89 d0                	mov    %edx,%eax
c01008dc:	01 c0                	add    %eax,%eax
c01008de:	01 d0                	add    %edx,%eax
c01008e0:	c1 e0 02             	shl    $0x2,%eax
c01008e3:	89 c2                	mov    %eax,%edx
c01008e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008e8:	01 d0                	add    %edx,%eax
c01008ea:	8b 40 08             	mov    0x8(%eax),%eax
c01008ed:	85 c0                	test   %eax,%eax
c01008ef:	74 99                	je     c010088a <debuginfo_eip+0x220>
    }
    if (lline >= lfile && stabs[lline].n_strx < stabstr_end - stabstr) {
c01008f1:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01008f4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01008f7:	39 c2                	cmp    %eax,%edx
c01008f9:	7c 42                	jl     c010093d <debuginfo_eip+0x2d3>
c01008fb:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01008fe:	89 c2                	mov    %eax,%edx
c0100900:	89 d0                	mov    %edx,%eax
c0100902:	01 c0                	add    %eax,%eax
c0100904:	01 d0                	add    %edx,%eax
c0100906:	c1 e0 02             	shl    $0x2,%eax
c0100909:	89 c2                	mov    %eax,%edx
c010090b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010090e:	01 d0                	add    %edx,%eax
c0100910:	8b 10                	mov    (%eax),%edx
c0100912:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100915:	2b 45 ec             	sub    -0x14(%ebp),%eax
c0100918:	39 c2                	cmp    %eax,%edx
c010091a:	73 21                	jae    c010093d <debuginfo_eip+0x2d3>
        info->eip_file = stabstr + stabs[lline].n_strx;
c010091c:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010091f:	89 c2                	mov    %eax,%edx
c0100921:	89 d0                	mov    %edx,%eax
c0100923:	01 c0                	add    %eax,%eax
c0100925:	01 d0                	add    %edx,%eax
c0100927:	c1 e0 02             	shl    $0x2,%eax
c010092a:	89 c2                	mov    %eax,%edx
c010092c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010092f:	01 d0                	add    %edx,%eax
c0100931:	8b 10                	mov    (%eax),%edx
c0100933:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100936:	01 c2                	add    %eax,%edx
c0100938:	8b 45 0c             	mov    0xc(%ebp),%eax
c010093b:	89 10                	mov    %edx,(%eax)
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
c010093d:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0100940:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100943:	39 c2                	cmp    %eax,%edx
c0100945:	7d 46                	jge    c010098d <debuginfo_eip+0x323>
        for (lline = lfun + 1;
c0100947:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010094a:	40                   	inc    %eax
c010094b:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c010094e:	eb 16                	jmp    c0100966 <debuginfo_eip+0x2fc>
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
            info->eip_fn_narg ++;
c0100950:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100953:	8b 40 14             	mov    0x14(%eax),%eax
c0100956:	8d 50 01             	lea    0x1(%eax),%edx
c0100959:	8b 45 0c             	mov    0xc(%ebp),%eax
c010095c:	89 50 14             	mov    %edx,0x14(%eax)
             lline ++) {
c010095f:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100962:	40                   	inc    %eax
c0100963:	89 45 d4             	mov    %eax,-0x2c(%ebp)
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100966:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100969:	8b 45 d8             	mov    -0x28(%ebp),%eax
        for (lline = lfun + 1;
c010096c:	39 c2                	cmp    %eax,%edx
c010096e:	7d 1d                	jge    c010098d <debuginfo_eip+0x323>
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100970:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100973:	89 c2                	mov    %eax,%edx
c0100975:	89 d0                	mov    %edx,%eax
c0100977:	01 c0                	add    %eax,%eax
c0100979:	01 d0                	add    %edx,%eax
c010097b:	c1 e0 02             	shl    $0x2,%eax
c010097e:	89 c2                	mov    %eax,%edx
c0100980:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100983:	01 d0                	add    %edx,%eax
c0100985:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100989:	3c a0                	cmp    $0xa0,%al
c010098b:	74 c3                	je     c0100950 <debuginfo_eip+0x2e6>
        }
    }
    return 0;
c010098d:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100992:	c9                   	leave  
c0100993:	c3                   	ret    

c0100994 <print_kerninfo>:
 * print_kerninfo - print the information about kernel, including the location
 * of kernel entry, the start addresses of data and text segements, the start
 * address of free memory and how many memory that kernel has used.
 * */
void
print_kerninfo(void) {
c0100994:	f3 0f 1e fb          	endbr32 
c0100998:	55                   	push   %ebp
c0100999:	89 e5                	mov    %esp,%ebp
c010099b:	83 ec 18             	sub    $0x18,%esp
    extern char etext[], edata[], end[], kern_init[];
    cprintf("Special kernel symbols:\n");
c010099e:	c7 04 24 82 a1 10 c0 	movl   $0xc010a182,(%esp)
c01009a5:	e8 27 f9 ff ff       	call   c01002d1 <cprintf>
    cprintf("  entry  0x%08x (phys)\n", kern_init);
c01009aa:	c7 44 24 04 36 00 10 	movl   $0xc0100036,0x4(%esp)
c01009b1:	c0 
c01009b2:	c7 04 24 9b a1 10 c0 	movl   $0xc010a19b,(%esp)
c01009b9:	e8 13 f9 ff ff       	call   c01002d1 <cprintf>
    cprintf("  etext  0x%08x (phys)\n", etext);
c01009be:	c7 44 24 04 65 a0 10 	movl   $0xc010a065,0x4(%esp)
c01009c5:	c0 
c01009c6:	c7 04 24 b3 a1 10 c0 	movl   $0xc010a1b3,(%esp)
c01009cd:	e8 ff f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("  edata  0x%08x (phys)\n", edata);
c01009d2:	c7 44 24 04 00 b0 12 	movl   $0xc012b000,0x4(%esp)
c01009d9:	c0 
c01009da:	c7 04 24 cb a1 10 c0 	movl   $0xc010a1cb,(%esp)
c01009e1:	e8 eb f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("  end    0x%08x (phys)\n", end);
c01009e6:	c7 44 24 04 58 e1 12 	movl   $0xc012e158,0x4(%esp)
c01009ed:	c0 
c01009ee:	c7 04 24 e3 a1 10 c0 	movl   $0xc010a1e3,(%esp)
c01009f5:	e8 d7 f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("Kernel executable memory footprint: %dKB\n", (end - kern_init + 1023)/1024);
c01009fa:	b8 58 e1 12 c0       	mov    $0xc012e158,%eax
c01009ff:	2d 36 00 10 c0       	sub    $0xc0100036,%eax
c0100a04:	05 ff 03 00 00       	add    $0x3ff,%eax
c0100a09:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c0100a0f:	85 c0                	test   %eax,%eax
c0100a11:	0f 48 c2             	cmovs  %edx,%eax
c0100a14:	c1 f8 0a             	sar    $0xa,%eax
c0100a17:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a1b:	c7 04 24 fc a1 10 c0 	movl   $0xc010a1fc,(%esp)
c0100a22:	e8 aa f8 ff ff       	call   c01002d1 <cprintf>
}
c0100a27:	90                   	nop
c0100a28:	c9                   	leave  
c0100a29:	c3                   	ret    

c0100a2a <print_debuginfo>:
/* *
 * print_debuginfo - read and print the stat information for the address @eip,
 * and info.eip_fn_addr should be the first address of the related function.
 * */
void
print_debuginfo(uintptr_t eip) {
c0100a2a:	f3 0f 1e fb          	endbr32 
c0100a2e:	55                   	push   %ebp
c0100a2f:	89 e5                	mov    %esp,%ebp
c0100a31:	81 ec 48 01 00 00    	sub    $0x148,%esp
    struct eipdebuginfo info;
    if (debuginfo_eip(eip, &info) != 0) {
c0100a37:	8d 45 dc             	lea    -0x24(%ebp),%eax
c0100a3a:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a3e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a41:	89 04 24             	mov    %eax,(%esp)
c0100a44:	e8 21 fc ff ff       	call   c010066a <debuginfo_eip>
c0100a49:	85 c0                	test   %eax,%eax
c0100a4b:	74 15                	je     c0100a62 <print_debuginfo+0x38>
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
c0100a4d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a50:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a54:	c7 04 24 26 a2 10 c0 	movl   $0xc010a226,(%esp)
c0100a5b:	e8 71 f8 ff ff       	call   c01002d1 <cprintf>
        }
        fnname[j] = '\0';
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
                fnname, eip - info.eip_fn_addr);
    }
}
c0100a60:	eb 6c                	jmp    c0100ace <print_debuginfo+0xa4>
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100a62:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100a69:	eb 1b                	jmp    c0100a86 <print_debuginfo+0x5c>
            fnname[j] = info.eip_fn_name[j];
c0100a6b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0100a6e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a71:	01 d0                	add    %edx,%eax
c0100a73:	0f b6 10             	movzbl (%eax),%edx
c0100a76:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c0100a7c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a7f:	01 c8                	add    %ecx,%eax
c0100a81:	88 10                	mov    %dl,(%eax)
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100a83:	ff 45 f4             	incl   -0xc(%ebp)
c0100a86:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100a89:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0100a8c:	7c dd                	jl     c0100a6b <print_debuginfo+0x41>
        fnname[j] = '\0';
c0100a8e:	8d 95 dc fe ff ff    	lea    -0x124(%ebp),%edx
c0100a94:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a97:	01 d0                	add    %edx,%eax
c0100a99:	c6 00 00             	movb   $0x0,(%eax)
                fnname, eip - info.eip_fn_addr);
c0100a9c:	8b 45 ec             	mov    -0x14(%ebp),%eax
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
c0100a9f:	8b 55 08             	mov    0x8(%ebp),%edx
c0100aa2:	89 d1                	mov    %edx,%ecx
c0100aa4:	29 c1                	sub    %eax,%ecx
c0100aa6:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0100aa9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100aac:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0100ab0:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c0100ab6:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0100aba:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100abe:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100ac2:	c7 04 24 42 a2 10 c0 	movl   $0xc010a242,(%esp)
c0100ac9:	e8 03 f8 ff ff       	call   c01002d1 <cprintf>
}
c0100ace:	90                   	nop
c0100acf:	c9                   	leave  
c0100ad0:	c3                   	ret    

c0100ad1 <read_eip>:

static __noinline uint32_t
read_eip(void) {
c0100ad1:	f3 0f 1e fb          	endbr32 
c0100ad5:	55                   	push   %ebp
c0100ad6:	89 e5                	mov    %esp,%ebp
c0100ad8:	83 ec 10             	sub    $0x10,%esp
    uint32_t eip;
    asm volatile("movl 4(%%ebp), %0" : "=r" (eip));
c0100adb:	8b 45 04             	mov    0x4(%ebp),%eax
c0100ade:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return eip;
c0100ae1:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0100ae4:	c9                   	leave  
c0100ae5:	c3                   	ret    

c0100ae6 <print_stackframe>:
 *
 * Note that, the length of ebp-chain is limited. In boot/bootasm.S, before jumping
 * to the kernel entry, the value of ebp has been set to zero, that's the boundary.
 * */
void
print_stackframe(void) {
c0100ae6:	f3 0f 1e fb          	endbr32 
c0100aea:	55                   	push   %ebp
c0100aeb:	89 e5                	mov    %esp,%ebp
c0100aed:	83 ec 38             	sub    $0x38,%esp
}

static inline uint32_t
read_ebp(void) {
    uint32_t ebp;
    asm volatile ("movl %%ebp, %0" : "=r" (ebp));
c0100af0:	89 e8                	mov    %ebp,%eax
c0100af2:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return ebp;
c0100af5:	8b 45 e0             	mov    -0x20(%ebp),%eax
      *    (3.4) call print_debuginfo(eip-1) to print the C calling function name and line number, etc.
      *    (3.5) popup a calling stackframe
      *           NOTICE: the calling funciton's return addr eip  = ss:[ebp+4]
      *                   the calling funciton's ebp = ss:[ebp]
      */
	uint32_t ebp=read_ebp(),eip=read_eip();
c0100af8:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100afb:	e8 d1 ff ff ff       	call   c0100ad1 <read_eip>
c0100b00:	89 45 f0             	mov    %eax,-0x10(%ebp)
	int i,j;
	for(i=0;ebp!=0&&i<STACKFRAME_DEPTH;i++)
c0100b03:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0100b0a:	e9 84 00 00 00       	jmp    c0100b93 <print_stackframe+0xad>
	{cprintf("ebp:0x%08x eip:0x%08x args:",ebp,eip);
c0100b0f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100b12:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100b16:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b19:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b1d:	c7 04 24 54 a2 10 c0 	movl   $0xc010a254,(%esp)
c0100b24:	e8 a8 f7 ff ff       	call   c01002d1 <cprintf>
	 uint32_t *args=(uint32_t *)ebp + 2;
c0100b29:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b2c:	83 c0 08             	add    $0x8,%eax
c0100b2f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	 for(j=0;j<4;j++) cprintf("0x%08x ",args[j]);
c0100b32:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0100b39:	eb 24                	jmp    c0100b5f <print_stackframe+0x79>
c0100b3b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100b3e:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0100b45:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100b48:	01 d0                	add    %edx,%eax
c0100b4a:	8b 00                	mov    (%eax),%eax
c0100b4c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b50:	c7 04 24 70 a2 10 c0 	movl   $0xc010a270,(%esp)
c0100b57:	e8 75 f7 ff ff       	call   c01002d1 <cprintf>
c0100b5c:	ff 45 e8             	incl   -0x18(%ebp)
c0100b5f:	83 7d e8 03          	cmpl   $0x3,-0x18(%ebp)
c0100b63:	7e d6                	jle    c0100b3b <print_stackframe+0x55>
	 cprintf("\n");
c0100b65:	c7 04 24 78 a2 10 c0 	movl   $0xc010a278,(%esp)
c0100b6c:	e8 60 f7 ff ff       	call   c01002d1 <cprintf>
	 print_debuginfo(eip-1);
c0100b71:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100b74:	48                   	dec    %eax
c0100b75:	89 04 24             	mov    %eax,(%esp)
c0100b78:	e8 ad fe ff ff       	call   c0100a2a <print_debuginfo>
	 eip=((uint32_t *)ebp)[1];
c0100b7d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b80:	83 c0 04             	add    $0x4,%eax
c0100b83:	8b 00                	mov    (%eax),%eax
c0100b85:	89 45 f0             	mov    %eax,-0x10(%ebp)
	 ebp=((uint32_t *)ebp)[0];
c0100b88:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b8b:	8b 00                	mov    (%eax),%eax
c0100b8d:	89 45 f4             	mov    %eax,-0xc(%ebp)
	for(i=0;ebp!=0&&i<STACKFRAME_DEPTH;i++)
c0100b90:	ff 45 ec             	incl   -0x14(%ebp)
c0100b93:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100b97:	74 0a                	je     c0100ba3 <print_stackframe+0xbd>
c0100b99:	83 7d ec 13          	cmpl   $0x13,-0x14(%ebp)
c0100b9d:	0f 8e 6c ff ff ff    	jle    c0100b0f <print_stackframe+0x29>
	}
}
c0100ba3:	90                   	nop
c0100ba4:	c9                   	leave  
c0100ba5:	c3                   	ret    

c0100ba6 <parse>:
#define MAXARGS         16
#define WHITESPACE      " \t\n\r"

/* parse - parse the command buffer into whitespace-separated arguments */
static int
parse(char *buf, char **argv) {
c0100ba6:	f3 0f 1e fb          	endbr32 
c0100baa:	55                   	push   %ebp
c0100bab:	89 e5                	mov    %esp,%ebp
c0100bad:	83 ec 28             	sub    $0x28,%esp
    int argc = 0;
c0100bb0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100bb7:	eb 0c                	jmp    c0100bc5 <parse+0x1f>
            *buf ++ = '\0';
c0100bb9:	8b 45 08             	mov    0x8(%ebp),%eax
c0100bbc:	8d 50 01             	lea    0x1(%eax),%edx
c0100bbf:	89 55 08             	mov    %edx,0x8(%ebp)
c0100bc2:	c6 00 00             	movb   $0x0,(%eax)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100bc5:	8b 45 08             	mov    0x8(%ebp),%eax
c0100bc8:	0f b6 00             	movzbl (%eax),%eax
c0100bcb:	84 c0                	test   %al,%al
c0100bcd:	74 1d                	je     c0100bec <parse+0x46>
c0100bcf:	8b 45 08             	mov    0x8(%ebp),%eax
c0100bd2:	0f b6 00             	movzbl (%eax),%eax
c0100bd5:	0f be c0             	movsbl %al,%eax
c0100bd8:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100bdc:	c7 04 24 fc a2 10 c0 	movl   $0xc010a2fc,(%esp)
c0100be3:	e8 8e 89 00 00       	call   c0109576 <strchr>
c0100be8:	85 c0                	test   %eax,%eax
c0100bea:	75 cd                	jne    c0100bb9 <parse+0x13>
        }
        if (*buf == '\0') {
c0100bec:	8b 45 08             	mov    0x8(%ebp),%eax
c0100bef:	0f b6 00             	movzbl (%eax),%eax
c0100bf2:	84 c0                	test   %al,%al
c0100bf4:	74 65                	je     c0100c5b <parse+0xb5>
            break;
        }

        // save and scan past next arg
        if (argc == MAXARGS - 1) {
c0100bf6:	83 7d f4 0f          	cmpl   $0xf,-0xc(%ebp)
c0100bfa:	75 14                	jne    c0100c10 <parse+0x6a>
            cprintf("Too many arguments (max %d).\n", MAXARGS);
c0100bfc:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
c0100c03:	00 
c0100c04:	c7 04 24 01 a3 10 c0 	movl   $0xc010a301,(%esp)
c0100c0b:	e8 c1 f6 ff ff       	call   c01002d1 <cprintf>
        }
        argv[argc ++] = buf;
c0100c10:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100c13:	8d 50 01             	lea    0x1(%eax),%edx
c0100c16:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0100c19:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0100c20:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100c23:	01 c2                	add    %eax,%edx
c0100c25:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c28:	89 02                	mov    %eax,(%edx)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100c2a:	eb 03                	jmp    c0100c2f <parse+0x89>
            buf ++;
c0100c2c:	ff 45 08             	incl   0x8(%ebp)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100c2f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c32:	0f b6 00             	movzbl (%eax),%eax
c0100c35:	84 c0                	test   %al,%al
c0100c37:	74 8c                	je     c0100bc5 <parse+0x1f>
c0100c39:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c3c:	0f b6 00             	movzbl (%eax),%eax
c0100c3f:	0f be c0             	movsbl %al,%eax
c0100c42:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c46:	c7 04 24 fc a2 10 c0 	movl   $0xc010a2fc,(%esp)
c0100c4d:	e8 24 89 00 00       	call   c0109576 <strchr>
c0100c52:	85 c0                	test   %eax,%eax
c0100c54:	74 d6                	je     c0100c2c <parse+0x86>
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100c56:	e9 6a ff ff ff       	jmp    c0100bc5 <parse+0x1f>
            break;
c0100c5b:	90                   	nop
        }
    }
    return argc;
c0100c5c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100c5f:	c9                   	leave  
c0100c60:	c3                   	ret    

c0100c61 <runcmd>:
/* *
 * runcmd - parse the input string, split it into separated arguments
 * and then lookup and invoke some related commands/
 * */
static int
runcmd(char *buf, struct trapframe *tf) {
c0100c61:	f3 0f 1e fb          	endbr32 
c0100c65:	55                   	push   %ebp
c0100c66:	89 e5                	mov    %esp,%ebp
c0100c68:	53                   	push   %ebx
c0100c69:	83 ec 64             	sub    $0x64,%esp
    char *argv[MAXARGS];
    int argc = parse(buf, argv);
c0100c6c:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0100c6f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c73:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c76:	89 04 24             	mov    %eax,(%esp)
c0100c79:	e8 28 ff ff ff       	call   c0100ba6 <parse>
c0100c7e:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (argc == 0) {
c0100c81:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0100c85:	75 0a                	jne    c0100c91 <runcmd+0x30>
        return 0;
c0100c87:	b8 00 00 00 00       	mov    $0x0,%eax
c0100c8c:	e9 83 00 00 00       	jmp    c0100d14 <runcmd+0xb3>
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100c91:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100c98:	eb 5a                	jmp    c0100cf4 <runcmd+0x93>
        if (strcmp(commands[i].name, argv[0]) == 0) {
c0100c9a:	8b 4d b0             	mov    -0x50(%ebp),%ecx
c0100c9d:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100ca0:	89 d0                	mov    %edx,%eax
c0100ca2:	01 c0                	add    %eax,%eax
c0100ca4:	01 d0                	add    %edx,%eax
c0100ca6:	c1 e0 02             	shl    $0x2,%eax
c0100ca9:	05 00 80 12 c0       	add    $0xc0128000,%eax
c0100cae:	8b 00                	mov    (%eax),%eax
c0100cb0:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0100cb4:	89 04 24             	mov    %eax,(%esp)
c0100cb7:	e8 16 88 00 00       	call   c01094d2 <strcmp>
c0100cbc:	85 c0                	test   %eax,%eax
c0100cbe:	75 31                	jne    c0100cf1 <runcmd+0x90>
            return commands[i].func(argc - 1, argv + 1, tf);
c0100cc0:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100cc3:	89 d0                	mov    %edx,%eax
c0100cc5:	01 c0                	add    %eax,%eax
c0100cc7:	01 d0                	add    %edx,%eax
c0100cc9:	c1 e0 02             	shl    $0x2,%eax
c0100ccc:	05 08 80 12 c0       	add    $0xc0128008,%eax
c0100cd1:	8b 10                	mov    (%eax),%edx
c0100cd3:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0100cd6:	83 c0 04             	add    $0x4,%eax
c0100cd9:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0100cdc:	8d 59 ff             	lea    -0x1(%ecx),%ebx
c0100cdf:	8b 4d 0c             	mov    0xc(%ebp),%ecx
c0100ce2:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0100ce6:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100cea:	89 1c 24             	mov    %ebx,(%esp)
c0100ced:	ff d2                	call   *%edx
c0100cef:	eb 23                	jmp    c0100d14 <runcmd+0xb3>
    for (i = 0; i < NCOMMANDS; i ++) {
c0100cf1:	ff 45 f4             	incl   -0xc(%ebp)
c0100cf4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100cf7:	83 f8 02             	cmp    $0x2,%eax
c0100cfa:	76 9e                	jbe    c0100c9a <runcmd+0x39>
        }
    }
    cprintf("Unknown command '%s'\n", argv[0]);
c0100cfc:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0100cff:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d03:	c7 04 24 1f a3 10 c0 	movl   $0xc010a31f,(%esp)
c0100d0a:	e8 c2 f5 ff ff       	call   c01002d1 <cprintf>
    return 0;
c0100d0f:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100d14:	83 c4 64             	add    $0x64,%esp
c0100d17:	5b                   	pop    %ebx
c0100d18:	5d                   	pop    %ebp
c0100d19:	c3                   	ret    

c0100d1a <kmonitor>:

/***** Implementations of basic kernel monitor commands *****/

void
kmonitor(struct trapframe *tf) {
c0100d1a:	f3 0f 1e fb          	endbr32 
c0100d1e:	55                   	push   %ebp
c0100d1f:	89 e5                	mov    %esp,%ebp
c0100d21:	83 ec 28             	sub    $0x28,%esp
    cprintf("Welcome to the kernel debug monitor!!\n");
c0100d24:	c7 04 24 38 a3 10 c0 	movl   $0xc010a338,(%esp)
c0100d2b:	e8 a1 f5 ff ff       	call   c01002d1 <cprintf>
    cprintf("Type 'help' for a list of commands.\n");
c0100d30:	c7 04 24 60 a3 10 c0 	movl   $0xc010a360,(%esp)
c0100d37:	e8 95 f5 ff ff       	call   c01002d1 <cprintf>

    if (tf != NULL) {
c0100d3c:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100d40:	74 0b                	je     c0100d4d <kmonitor+0x33>
        print_trapframe(tf);
c0100d42:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d45:	89 04 24             	mov    %eax,(%esp)
c0100d48:	e8 50 16 00 00       	call   c010239d <print_trapframe>
    }

    char *buf;
    while (1) {
        if ((buf = readline("K> ")) != NULL) {
c0100d4d:	c7 04 24 85 a3 10 c0 	movl   $0xc010a385,(%esp)
c0100d54:	e8 2b f6 ff ff       	call   c0100384 <readline>
c0100d59:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100d5c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100d60:	74 eb                	je     c0100d4d <kmonitor+0x33>
            if (runcmd(buf, tf) < 0) {
c0100d62:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d65:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d69:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100d6c:	89 04 24             	mov    %eax,(%esp)
c0100d6f:	e8 ed fe ff ff       	call   c0100c61 <runcmd>
c0100d74:	85 c0                	test   %eax,%eax
c0100d76:	78 02                	js     c0100d7a <kmonitor+0x60>
        if ((buf = readline("K> ")) != NULL) {
c0100d78:	eb d3                	jmp    c0100d4d <kmonitor+0x33>
                break;
c0100d7a:	90                   	nop
            }
        }
    }
}
c0100d7b:	90                   	nop
c0100d7c:	c9                   	leave  
c0100d7d:	c3                   	ret    

c0100d7e <mon_help>:

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
c0100d7e:	f3 0f 1e fb          	endbr32 
c0100d82:	55                   	push   %ebp
c0100d83:	89 e5                	mov    %esp,%ebp
c0100d85:	83 ec 28             	sub    $0x28,%esp
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100d88:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100d8f:	eb 3d                	jmp    c0100dce <mon_help+0x50>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
c0100d91:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100d94:	89 d0                	mov    %edx,%eax
c0100d96:	01 c0                	add    %eax,%eax
c0100d98:	01 d0                	add    %edx,%eax
c0100d9a:	c1 e0 02             	shl    $0x2,%eax
c0100d9d:	05 04 80 12 c0       	add    $0xc0128004,%eax
c0100da2:	8b 08                	mov    (%eax),%ecx
c0100da4:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100da7:	89 d0                	mov    %edx,%eax
c0100da9:	01 c0                	add    %eax,%eax
c0100dab:	01 d0                	add    %edx,%eax
c0100dad:	c1 e0 02             	shl    $0x2,%eax
c0100db0:	05 00 80 12 c0       	add    $0xc0128000,%eax
c0100db5:	8b 00                	mov    (%eax),%eax
c0100db7:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0100dbb:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100dbf:	c7 04 24 89 a3 10 c0 	movl   $0xc010a389,(%esp)
c0100dc6:	e8 06 f5 ff ff       	call   c01002d1 <cprintf>
    for (i = 0; i < NCOMMANDS; i ++) {
c0100dcb:	ff 45 f4             	incl   -0xc(%ebp)
c0100dce:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100dd1:	83 f8 02             	cmp    $0x2,%eax
c0100dd4:	76 bb                	jbe    c0100d91 <mon_help+0x13>
    }
    return 0;
c0100dd6:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100ddb:	c9                   	leave  
c0100ddc:	c3                   	ret    

c0100ddd <mon_kerninfo>:
/* *
 * mon_kerninfo - call print_kerninfo in kern/debug/kdebug.c to
 * print the memory occupancy in kernel.
 * */
int
mon_kerninfo(int argc, char **argv, struct trapframe *tf) {
c0100ddd:	f3 0f 1e fb          	endbr32 
c0100de1:	55                   	push   %ebp
c0100de2:	89 e5                	mov    %esp,%ebp
c0100de4:	83 ec 08             	sub    $0x8,%esp
    print_kerninfo();
c0100de7:	e8 a8 fb ff ff       	call   c0100994 <print_kerninfo>
    return 0;
c0100dec:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100df1:	c9                   	leave  
c0100df2:	c3                   	ret    

c0100df3 <mon_backtrace>:
/* *
 * mon_backtrace - call print_stackframe in kern/debug/kdebug.c to
 * print a backtrace of the stack.
 * */
int
mon_backtrace(int argc, char **argv, struct trapframe *tf) {
c0100df3:	f3 0f 1e fb          	endbr32 
c0100df7:	55                   	push   %ebp
c0100df8:	89 e5                	mov    %esp,%ebp
c0100dfa:	83 ec 08             	sub    $0x8,%esp
    print_stackframe();
c0100dfd:	e8 e4 fc ff ff       	call   c0100ae6 <print_stackframe>
    return 0;
c0100e02:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100e07:	c9                   	leave  
c0100e08:	c3                   	ret    

c0100e09 <ide_wait_ready>:
    unsigned int size;          // Size in Sectors
    unsigned char model[41];    // Model in String
} ide_devices[MAX_IDE];

static int
ide_wait_ready(unsigned short iobase, bool check_error) {
c0100e09:	f3 0f 1e fb          	endbr32 
c0100e0d:	55                   	push   %ebp
c0100e0e:	89 e5                	mov    %esp,%ebp
c0100e10:	83 ec 14             	sub    $0x14,%esp
c0100e13:	8b 45 08             	mov    0x8(%ebp),%eax
c0100e16:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    int r;
    while ((r = inb(iobase + ISA_STATUS)) & IDE_BSY)
c0100e1a:	90                   	nop
c0100e1b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100e1e:	83 c0 07             	add    $0x7,%eax
c0100e21:	0f b7 c0             	movzwl %ax,%eax
c0100e24:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100e28:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0100e2c:	89 c2                	mov    %eax,%edx
c0100e2e:	ec                   	in     (%dx),%al
c0100e2f:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0100e32:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0100e36:	0f b6 c0             	movzbl %al,%eax
c0100e39:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0100e3c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100e3f:	25 80 00 00 00       	and    $0x80,%eax
c0100e44:	85 c0                	test   %eax,%eax
c0100e46:	75 d3                	jne    c0100e1b <ide_wait_ready+0x12>
        /* nothing */;
    if (check_error && (r & (IDE_DF | IDE_ERR)) != 0) {
c0100e48:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0100e4c:	74 11                	je     c0100e5f <ide_wait_ready+0x56>
c0100e4e:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100e51:	83 e0 21             	and    $0x21,%eax
c0100e54:	85 c0                	test   %eax,%eax
c0100e56:	74 07                	je     c0100e5f <ide_wait_ready+0x56>
        return -1;
c0100e58:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100e5d:	eb 05                	jmp    c0100e64 <ide_wait_ready+0x5b>
    }
    return 0;
c0100e5f:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100e64:	c9                   	leave  
c0100e65:	c3                   	ret    

c0100e66 <ide_init>:

void
ide_init(void) {
c0100e66:	f3 0f 1e fb          	endbr32 
c0100e6a:	55                   	push   %ebp
c0100e6b:	89 e5                	mov    %esp,%ebp
c0100e6d:	57                   	push   %edi
c0100e6e:	53                   	push   %ebx
c0100e6f:	81 ec 50 02 00 00    	sub    $0x250,%esp
    static_assert((SECTSIZE % 4) == 0);
    unsigned short ideno, iobase;
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c0100e75:	66 c7 45 f6 00 00    	movw   $0x0,-0xa(%ebp)
c0100e7b:	e9 bd 02 00 00       	jmp    c010113d <ide_init+0x2d7>
        /* assume that no device here */
        ide_devices[ideno].valid = 0;
c0100e80:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100e84:	89 d0                	mov    %edx,%eax
c0100e86:	c1 e0 03             	shl    $0x3,%eax
c0100e89:	29 d0                	sub    %edx,%eax
c0100e8b:	c1 e0 03             	shl    $0x3,%eax
c0100e8e:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0100e93:	c6 00 00             	movb   $0x0,(%eax)

        iobase = IO_BASE(ideno);
c0100e96:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100e9a:	d1 e8                	shr    %eax
c0100e9c:	0f b7 c0             	movzwl %ax,%eax
c0100e9f:	8b 04 85 94 a3 10 c0 	mov    -0x3fef5c6c(,%eax,4),%eax
c0100ea6:	66 89 45 ea          	mov    %ax,-0x16(%ebp)

        /* wait device ready */
        ide_wait_ready(iobase, 0);
c0100eaa:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100eae:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100eb5:	00 
c0100eb6:	89 04 24             	mov    %eax,(%esp)
c0100eb9:	e8 4b ff ff ff       	call   c0100e09 <ide_wait_ready>

        /* step1: select drive */
        outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4));
c0100ebe:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100ec2:	c1 e0 04             	shl    $0x4,%eax
c0100ec5:	24 10                	and    $0x10,%al
c0100ec7:	0c e0                	or     $0xe0,%al
c0100ec9:	0f b6 c0             	movzbl %al,%eax
c0100ecc:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0100ed0:	83 c2 06             	add    $0x6,%edx
c0100ed3:	0f b7 d2             	movzwl %dx,%edx
c0100ed6:	66 89 55 ca          	mov    %dx,-0x36(%ebp)
c0100eda:	88 45 c9             	mov    %al,-0x37(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100edd:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c0100ee1:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c0100ee5:	ee                   	out    %al,(%dx)
}
c0100ee6:	90                   	nop
        ide_wait_ready(iobase, 0);
c0100ee7:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100eeb:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100ef2:	00 
c0100ef3:	89 04 24             	mov    %eax,(%esp)
c0100ef6:	e8 0e ff ff ff       	call   c0100e09 <ide_wait_ready>

        /* step2: send ATA identify command */
        outb(iobase + ISA_COMMAND, IDE_CMD_IDENTIFY);
c0100efb:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100eff:	83 c0 07             	add    $0x7,%eax
c0100f02:	0f b7 c0             	movzwl %ax,%eax
c0100f05:	66 89 45 ce          	mov    %ax,-0x32(%ebp)
c0100f09:	c6 45 cd ec          	movb   $0xec,-0x33(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100f0d:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c0100f11:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c0100f15:	ee                   	out    %al,(%dx)
}
c0100f16:	90                   	nop
        ide_wait_ready(iobase, 0);
c0100f17:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100f1b:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100f22:	00 
c0100f23:	89 04 24             	mov    %eax,(%esp)
c0100f26:	e8 de fe ff ff       	call   c0100e09 <ide_wait_ready>

        /* step3: polling */
        if (inb(iobase + ISA_STATUS) == 0 || ide_wait_ready(iobase, 1) != 0) {
c0100f2b:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100f2f:	83 c0 07             	add    $0x7,%eax
c0100f32:	0f b7 c0             	movzwl %ax,%eax
c0100f35:	66 89 45 d2          	mov    %ax,-0x2e(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100f39:	0f b7 45 d2          	movzwl -0x2e(%ebp),%eax
c0100f3d:	89 c2                	mov    %eax,%edx
c0100f3f:	ec                   	in     (%dx),%al
c0100f40:	88 45 d1             	mov    %al,-0x2f(%ebp)
    return data;
c0100f43:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c0100f47:	84 c0                	test   %al,%al
c0100f49:	0f 84 e4 01 00 00    	je     c0101133 <ide_init+0x2cd>
c0100f4f:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100f53:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0100f5a:	00 
c0100f5b:	89 04 24             	mov    %eax,(%esp)
c0100f5e:	e8 a6 fe ff ff       	call   c0100e09 <ide_wait_ready>
c0100f63:	85 c0                	test   %eax,%eax
c0100f65:	0f 85 c8 01 00 00    	jne    c0101133 <ide_init+0x2cd>
            continue ;
        }

        /* device is ok */
        ide_devices[ideno].valid = 1;
c0100f6b:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100f6f:	89 d0                	mov    %edx,%eax
c0100f71:	c1 e0 03             	shl    $0x3,%eax
c0100f74:	29 d0                	sub    %edx,%eax
c0100f76:	c1 e0 03             	shl    $0x3,%eax
c0100f79:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0100f7e:	c6 00 01             	movb   $0x1,(%eax)

        /* read identification space of the device */
        unsigned int buffer[128];
        insl(iobase + ISA_DATA, buffer, sizeof(buffer) / sizeof(unsigned int));
c0100f81:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100f85:	89 45 c4             	mov    %eax,-0x3c(%ebp)
c0100f88:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c0100f8e:	89 45 c0             	mov    %eax,-0x40(%ebp)
c0100f91:	c7 45 bc 80 00 00 00 	movl   $0x80,-0x44(%ebp)
    asm volatile (
c0100f98:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0100f9b:	8b 4d c0             	mov    -0x40(%ebp),%ecx
c0100f9e:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0100fa1:	89 cb                	mov    %ecx,%ebx
c0100fa3:	89 df                	mov    %ebx,%edi
c0100fa5:	89 c1                	mov    %eax,%ecx
c0100fa7:	fc                   	cld    
c0100fa8:	f2 6d                	repnz insl (%dx),%es:(%edi)
c0100faa:	89 c8                	mov    %ecx,%eax
c0100fac:	89 fb                	mov    %edi,%ebx
c0100fae:	89 5d c0             	mov    %ebx,-0x40(%ebp)
c0100fb1:	89 45 bc             	mov    %eax,-0x44(%ebp)
}
c0100fb4:	90                   	nop

        unsigned char *ident = (unsigned char *)buffer;
c0100fb5:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c0100fbb:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        unsigned int sectors;
        unsigned int cmdsets = *(unsigned int *)(ident + IDE_IDENT_CMDSETS);
c0100fbe:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100fc1:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
c0100fc7:	89 45 e0             	mov    %eax,-0x20(%ebp)
        /* device use 48-bits or 28-bits addressing */
        if (cmdsets & (1 << 26)) {
c0100fca:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100fcd:	25 00 00 00 04       	and    $0x4000000,%eax
c0100fd2:	85 c0                	test   %eax,%eax
c0100fd4:	74 0e                	je     c0100fe4 <ide_init+0x17e>
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA_EXT);
c0100fd6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100fd9:	8b 80 c8 00 00 00    	mov    0xc8(%eax),%eax
c0100fdf:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0100fe2:	eb 09                	jmp    c0100fed <ide_init+0x187>
        }
        else {
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA);
c0100fe4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100fe7:	8b 40 78             	mov    0x78(%eax),%eax
c0100fea:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        ide_devices[ideno].sets = cmdsets;
c0100fed:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100ff1:	89 d0                	mov    %edx,%eax
c0100ff3:	c1 e0 03             	shl    $0x3,%eax
c0100ff6:	29 d0                	sub    %edx,%eax
c0100ff8:	c1 e0 03             	shl    $0x3,%eax
c0100ffb:	8d 90 44 b4 12 c0    	lea    -0x3fed4bbc(%eax),%edx
c0101001:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101004:	89 02                	mov    %eax,(%edx)
        ide_devices[ideno].size = sectors;
c0101006:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c010100a:	89 d0                	mov    %edx,%eax
c010100c:	c1 e0 03             	shl    $0x3,%eax
c010100f:	29 d0                	sub    %edx,%eax
c0101011:	c1 e0 03             	shl    $0x3,%eax
c0101014:	8d 90 48 b4 12 c0    	lea    -0x3fed4bb8(%eax),%edx
c010101a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010101d:	89 02                	mov    %eax,(%edx)

        /* check if supports LBA */
        assert((*(unsigned short *)(ident + IDE_IDENT_CAPABILITIES) & 0x200) != 0);
c010101f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101022:	83 c0 62             	add    $0x62,%eax
c0101025:	0f b7 00             	movzwl (%eax),%eax
c0101028:	25 00 02 00 00       	and    $0x200,%eax
c010102d:	85 c0                	test   %eax,%eax
c010102f:	75 24                	jne    c0101055 <ide_init+0x1ef>
c0101031:	c7 44 24 0c 9c a3 10 	movl   $0xc010a39c,0xc(%esp)
c0101038:	c0 
c0101039:	c7 44 24 08 df a3 10 	movl   $0xc010a3df,0x8(%esp)
c0101040:	c0 
c0101041:	c7 44 24 04 7d 00 00 	movl   $0x7d,0x4(%esp)
c0101048:	00 
c0101049:	c7 04 24 f4 a3 10 c0 	movl   $0xc010a3f4,(%esp)
c0101050:	e8 e8 f3 ff ff       	call   c010043d <__panic>

        unsigned char *model = ide_devices[ideno].model, *data = ident + IDE_IDENT_MODEL;
c0101055:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101059:	89 d0                	mov    %edx,%eax
c010105b:	c1 e0 03             	shl    $0x3,%eax
c010105e:	29 d0                	sub    %edx,%eax
c0101060:	c1 e0 03             	shl    $0x3,%eax
c0101063:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0101068:	83 c0 0c             	add    $0xc,%eax
c010106b:	89 45 dc             	mov    %eax,-0x24(%ebp)
c010106e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101071:	83 c0 36             	add    $0x36,%eax
c0101074:	89 45 d8             	mov    %eax,-0x28(%ebp)
        unsigned int i, length = 40;
c0101077:	c7 45 d4 28 00 00 00 	movl   $0x28,-0x2c(%ebp)
        for (i = 0; i < length; i += 2) {
c010107e:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0101085:	eb 34                	jmp    c01010bb <ide_init+0x255>
            model[i] = data[i + 1], model[i + 1] = data[i];
c0101087:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010108a:	8d 50 01             	lea    0x1(%eax),%edx
c010108d:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0101090:	01 c2                	add    %eax,%edx
c0101092:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0101095:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101098:	01 c8                	add    %ecx,%eax
c010109a:	0f b6 12             	movzbl (%edx),%edx
c010109d:	88 10                	mov    %dl,(%eax)
c010109f:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01010a2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01010a5:	01 c2                	add    %eax,%edx
c01010a7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01010aa:	8d 48 01             	lea    0x1(%eax),%ecx
c01010ad:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01010b0:	01 c8                	add    %ecx,%eax
c01010b2:	0f b6 12             	movzbl (%edx),%edx
c01010b5:	88 10                	mov    %dl,(%eax)
        for (i = 0; i < length; i += 2) {
c01010b7:	83 45 ec 02          	addl   $0x2,-0x14(%ebp)
c01010bb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01010be:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c01010c1:	72 c4                	jb     c0101087 <ide_init+0x221>
        }
        do {
            model[i] = '\0';
c01010c3:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01010c6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01010c9:	01 d0                	add    %edx,%eax
c01010cb:	c6 00 00             	movb   $0x0,(%eax)
        } while (i -- > 0 && model[i] == ' ');
c01010ce:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01010d1:	8d 50 ff             	lea    -0x1(%eax),%edx
c01010d4:	89 55 ec             	mov    %edx,-0x14(%ebp)
c01010d7:	85 c0                	test   %eax,%eax
c01010d9:	74 0f                	je     c01010ea <ide_init+0x284>
c01010db:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01010de:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01010e1:	01 d0                	add    %edx,%eax
c01010e3:	0f b6 00             	movzbl (%eax),%eax
c01010e6:	3c 20                	cmp    $0x20,%al
c01010e8:	74 d9                	je     c01010c3 <ide_init+0x25d>

        cprintf("ide %d: %10u(sectors), '%s'.\n", ideno, ide_devices[ideno].size, ide_devices[ideno].model);
c01010ea:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01010ee:	89 d0                	mov    %edx,%eax
c01010f0:	c1 e0 03             	shl    $0x3,%eax
c01010f3:	29 d0                	sub    %edx,%eax
c01010f5:	c1 e0 03             	shl    $0x3,%eax
c01010f8:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c01010fd:	8d 48 0c             	lea    0xc(%eax),%ecx
c0101100:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101104:	89 d0                	mov    %edx,%eax
c0101106:	c1 e0 03             	shl    $0x3,%eax
c0101109:	29 d0                	sub    %edx,%eax
c010110b:	c1 e0 03             	shl    $0x3,%eax
c010110e:	05 48 b4 12 c0       	add    $0xc012b448,%eax
c0101113:	8b 10                	mov    (%eax),%edx
c0101115:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101119:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c010111d:	89 54 24 08          	mov    %edx,0x8(%esp)
c0101121:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101125:	c7 04 24 06 a4 10 c0 	movl   $0xc010a406,(%esp)
c010112c:	e8 a0 f1 ff ff       	call   c01002d1 <cprintf>
c0101131:	eb 01                	jmp    c0101134 <ide_init+0x2ce>
            continue ;
c0101133:	90                   	nop
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c0101134:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101138:	40                   	inc    %eax
c0101139:	66 89 45 f6          	mov    %ax,-0xa(%ebp)
c010113d:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101141:	83 f8 03             	cmp    $0x3,%eax
c0101144:	0f 86 36 fd ff ff    	jbe    c0100e80 <ide_init+0x1a>
    }

    // enable ide interrupt
    pic_enable(IRQ_IDE1);
c010114a:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
c0101151:	e8 1f 0f 00 00       	call   c0102075 <pic_enable>
    pic_enable(IRQ_IDE2);
c0101156:	c7 04 24 0f 00 00 00 	movl   $0xf,(%esp)
c010115d:	e8 13 0f 00 00       	call   c0102075 <pic_enable>
}
c0101162:	90                   	nop
c0101163:	81 c4 50 02 00 00    	add    $0x250,%esp
c0101169:	5b                   	pop    %ebx
c010116a:	5f                   	pop    %edi
c010116b:	5d                   	pop    %ebp
c010116c:	c3                   	ret    

c010116d <ide_device_valid>:

bool
ide_device_valid(unsigned short ideno) {
c010116d:	f3 0f 1e fb          	endbr32 
c0101171:	55                   	push   %ebp
c0101172:	89 e5                	mov    %esp,%ebp
c0101174:	83 ec 04             	sub    $0x4,%esp
c0101177:	8b 45 08             	mov    0x8(%ebp),%eax
c010117a:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    return VALID_IDE(ideno);
c010117e:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c0101182:	83 f8 03             	cmp    $0x3,%eax
c0101185:	77 21                	ja     c01011a8 <ide_device_valid+0x3b>
c0101187:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
c010118b:	89 d0                	mov    %edx,%eax
c010118d:	c1 e0 03             	shl    $0x3,%eax
c0101190:	29 d0                	sub    %edx,%eax
c0101192:	c1 e0 03             	shl    $0x3,%eax
c0101195:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c010119a:	0f b6 00             	movzbl (%eax),%eax
c010119d:	84 c0                	test   %al,%al
c010119f:	74 07                	je     c01011a8 <ide_device_valid+0x3b>
c01011a1:	b8 01 00 00 00       	mov    $0x1,%eax
c01011a6:	eb 05                	jmp    c01011ad <ide_device_valid+0x40>
c01011a8:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01011ad:	c9                   	leave  
c01011ae:	c3                   	ret    

c01011af <ide_device_size>:

size_t
ide_device_size(unsigned short ideno) {
c01011af:	f3 0f 1e fb          	endbr32 
c01011b3:	55                   	push   %ebp
c01011b4:	89 e5                	mov    %esp,%ebp
c01011b6:	83 ec 08             	sub    $0x8,%esp
c01011b9:	8b 45 08             	mov    0x8(%ebp),%eax
c01011bc:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    if (ide_device_valid(ideno)) {
c01011c0:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c01011c4:	89 04 24             	mov    %eax,(%esp)
c01011c7:	e8 a1 ff ff ff       	call   c010116d <ide_device_valid>
c01011cc:	85 c0                	test   %eax,%eax
c01011ce:	74 17                	je     c01011e7 <ide_device_size+0x38>
        return ide_devices[ideno].size;
c01011d0:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
c01011d4:	89 d0                	mov    %edx,%eax
c01011d6:	c1 e0 03             	shl    $0x3,%eax
c01011d9:	29 d0                	sub    %edx,%eax
c01011db:	c1 e0 03             	shl    $0x3,%eax
c01011de:	05 48 b4 12 c0       	add    $0xc012b448,%eax
c01011e3:	8b 00                	mov    (%eax),%eax
c01011e5:	eb 05                	jmp    c01011ec <ide_device_size+0x3d>
    }
    return 0;
c01011e7:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01011ec:	c9                   	leave  
c01011ed:	c3                   	ret    

c01011ee <ide_read_secs>:

int
ide_read_secs(unsigned short ideno, uint32_t secno, void *dst, size_t nsecs) {
c01011ee:	f3 0f 1e fb          	endbr32 
c01011f2:	55                   	push   %ebp
c01011f3:	89 e5                	mov    %esp,%ebp
c01011f5:	57                   	push   %edi
c01011f6:	53                   	push   %ebx
c01011f7:	83 ec 50             	sub    $0x50,%esp
c01011fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01011fd:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c0101201:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c0101208:	77 23                	ja     c010122d <ide_read_secs+0x3f>
c010120a:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c010120e:	83 f8 03             	cmp    $0x3,%eax
c0101211:	77 1a                	ja     c010122d <ide_read_secs+0x3f>
c0101213:	0f b7 55 c4          	movzwl -0x3c(%ebp),%edx
c0101217:	89 d0                	mov    %edx,%eax
c0101219:	c1 e0 03             	shl    $0x3,%eax
c010121c:	29 d0                	sub    %edx,%eax
c010121e:	c1 e0 03             	shl    $0x3,%eax
c0101221:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0101226:	0f b6 00             	movzbl (%eax),%eax
c0101229:	84 c0                	test   %al,%al
c010122b:	75 24                	jne    c0101251 <ide_read_secs+0x63>
c010122d:	c7 44 24 0c 24 a4 10 	movl   $0xc010a424,0xc(%esp)
c0101234:	c0 
c0101235:	c7 44 24 08 df a3 10 	movl   $0xc010a3df,0x8(%esp)
c010123c:	c0 
c010123d:	c7 44 24 04 9f 00 00 	movl   $0x9f,0x4(%esp)
c0101244:	00 
c0101245:	c7 04 24 f4 a3 10 c0 	movl   $0xc010a3f4,(%esp)
c010124c:	e8 ec f1 ff ff       	call   c010043d <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c0101251:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c0101258:	77 0f                	ja     c0101269 <ide_read_secs+0x7b>
c010125a:	8b 55 0c             	mov    0xc(%ebp),%edx
c010125d:	8b 45 14             	mov    0x14(%ebp),%eax
c0101260:	01 d0                	add    %edx,%eax
c0101262:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c0101267:	76 24                	jbe    c010128d <ide_read_secs+0x9f>
c0101269:	c7 44 24 0c 4c a4 10 	movl   $0xc010a44c,0xc(%esp)
c0101270:	c0 
c0101271:	c7 44 24 08 df a3 10 	movl   $0xc010a3df,0x8(%esp)
c0101278:	c0 
c0101279:	c7 44 24 04 a0 00 00 	movl   $0xa0,0x4(%esp)
c0101280:	00 
c0101281:	c7 04 24 f4 a3 10 c0 	movl   $0xc010a3f4,(%esp)
c0101288:	e8 b0 f1 ff ff       	call   c010043d <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c010128d:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101291:	d1 e8                	shr    %eax
c0101293:	0f b7 c0             	movzwl %ax,%eax
c0101296:	8b 04 85 94 a3 10 c0 	mov    -0x3fef5c6c(,%eax,4),%eax
c010129d:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c01012a1:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c01012a5:	d1 e8                	shr    %eax
c01012a7:	0f b7 c0             	movzwl %ax,%eax
c01012aa:	0f b7 04 85 96 a3 10 	movzwl -0x3fef5c6a(,%eax,4),%eax
c01012b1:	c0 
c01012b2:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c01012b6:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01012ba:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01012c1:	00 
c01012c2:	89 04 24             	mov    %eax,(%esp)
c01012c5:	e8 3f fb ff ff       	call   c0100e09 <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c01012ca:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01012cd:	83 c0 02             	add    $0x2,%eax
c01012d0:	0f b7 c0             	movzwl %ax,%eax
c01012d3:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c01012d7:	c6 45 d5 00          	movb   $0x0,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01012db:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c01012df:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c01012e3:	ee                   	out    %al,(%dx)
}
c01012e4:	90                   	nop
    outb(iobase + ISA_SECCNT, nsecs);
c01012e5:	8b 45 14             	mov    0x14(%ebp),%eax
c01012e8:	0f b6 c0             	movzbl %al,%eax
c01012eb:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01012ef:	83 c2 02             	add    $0x2,%edx
c01012f2:	0f b7 d2             	movzwl %dx,%edx
c01012f5:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c01012f9:	88 45 d9             	mov    %al,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01012fc:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101300:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101304:	ee                   	out    %al,(%dx)
}
c0101305:	90                   	nop
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c0101306:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101309:	0f b6 c0             	movzbl %al,%eax
c010130c:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101310:	83 c2 03             	add    $0x3,%edx
c0101313:	0f b7 d2             	movzwl %dx,%edx
c0101316:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c010131a:	88 45 dd             	mov    %al,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010131d:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0101321:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0101325:	ee                   	out    %al,(%dx)
}
c0101326:	90                   	nop
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c0101327:	8b 45 0c             	mov    0xc(%ebp),%eax
c010132a:	c1 e8 08             	shr    $0x8,%eax
c010132d:	0f b6 c0             	movzbl %al,%eax
c0101330:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101334:	83 c2 04             	add    $0x4,%edx
c0101337:	0f b7 d2             	movzwl %dx,%edx
c010133a:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c010133e:	88 45 e1             	mov    %al,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101341:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0101345:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0101349:	ee                   	out    %al,(%dx)
}
c010134a:	90                   	nop
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c010134b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010134e:	c1 e8 10             	shr    $0x10,%eax
c0101351:	0f b6 c0             	movzbl %al,%eax
c0101354:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101358:	83 c2 05             	add    $0x5,%edx
c010135b:	0f b7 d2             	movzwl %dx,%edx
c010135e:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c0101362:	88 45 e5             	mov    %al,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101365:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101369:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c010136d:	ee                   	out    %al,(%dx)
}
c010136e:	90                   	nop
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c010136f:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0101372:	c0 e0 04             	shl    $0x4,%al
c0101375:	24 10                	and    $0x10,%al
c0101377:	88 c2                	mov    %al,%dl
c0101379:	8b 45 0c             	mov    0xc(%ebp),%eax
c010137c:	c1 e8 18             	shr    $0x18,%eax
c010137f:	24 0f                	and    $0xf,%al
c0101381:	08 d0                	or     %dl,%al
c0101383:	0c e0                	or     $0xe0,%al
c0101385:	0f b6 c0             	movzbl %al,%eax
c0101388:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010138c:	83 c2 06             	add    $0x6,%edx
c010138f:	0f b7 d2             	movzwl %dx,%edx
c0101392:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101396:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101399:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c010139d:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01013a1:	ee                   	out    %al,(%dx)
}
c01013a2:	90                   	nop
    outb(iobase + ISA_COMMAND, IDE_CMD_READ);
c01013a3:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01013a7:	83 c0 07             	add    $0x7,%eax
c01013aa:	0f b7 c0             	movzwl %ax,%eax
c01013ad:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c01013b1:	c6 45 ed 20          	movb   $0x20,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01013b5:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01013b9:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c01013bd:	ee                   	out    %al,(%dx)
}
c01013be:	90                   	nop

    int ret = 0;
c01013bf:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c01013c6:	eb 58                	jmp    c0101420 <ide_read_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c01013c8:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01013cc:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01013d3:	00 
c01013d4:	89 04 24             	mov    %eax,(%esp)
c01013d7:	e8 2d fa ff ff       	call   c0100e09 <ide_wait_ready>
c01013dc:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01013df:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01013e3:	75 43                	jne    c0101428 <ide_read_secs+0x23a>
            goto out;
        }
        insl(iobase, dst, SECTSIZE / sizeof(uint32_t));
c01013e5:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01013e9:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01013ec:	8b 45 10             	mov    0x10(%ebp),%eax
c01013ef:	89 45 cc             	mov    %eax,-0x34(%ebp)
c01013f2:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    asm volatile (
c01013f9:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01013fc:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c01013ff:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0101402:	89 cb                	mov    %ecx,%ebx
c0101404:	89 df                	mov    %ebx,%edi
c0101406:	89 c1                	mov    %eax,%ecx
c0101408:	fc                   	cld    
c0101409:	f2 6d                	repnz insl (%dx),%es:(%edi)
c010140b:	89 c8                	mov    %ecx,%eax
c010140d:	89 fb                	mov    %edi,%ebx
c010140f:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c0101412:	89 45 c8             	mov    %eax,-0x38(%ebp)
}
c0101415:	90                   	nop
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c0101416:	ff 4d 14             	decl   0x14(%ebp)
c0101419:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c0101420:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0101424:	75 a2                	jne    c01013c8 <ide_read_secs+0x1da>
    }

out:
c0101426:	eb 01                	jmp    c0101429 <ide_read_secs+0x23b>
            goto out;
c0101428:	90                   	nop
    return ret;
c0101429:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010142c:	83 c4 50             	add    $0x50,%esp
c010142f:	5b                   	pop    %ebx
c0101430:	5f                   	pop    %edi
c0101431:	5d                   	pop    %ebp
c0101432:	c3                   	ret    

c0101433 <ide_write_secs>:

int
ide_write_secs(unsigned short ideno, uint32_t secno, const void *src, size_t nsecs) {
c0101433:	f3 0f 1e fb          	endbr32 
c0101437:	55                   	push   %ebp
c0101438:	89 e5                	mov    %esp,%ebp
c010143a:	56                   	push   %esi
c010143b:	53                   	push   %ebx
c010143c:	83 ec 50             	sub    $0x50,%esp
c010143f:	8b 45 08             	mov    0x8(%ebp),%eax
c0101442:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c0101446:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c010144d:	77 23                	ja     c0101472 <ide_write_secs+0x3f>
c010144f:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101453:	83 f8 03             	cmp    $0x3,%eax
c0101456:	77 1a                	ja     c0101472 <ide_write_secs+0x3f>
c0101458:	0f b7 55 c4          	movzwl -0x3c(%ebp),%edx
c010145c:	89 d0                	mov    %edx,%eax
c010145e:	c1 e0 03             	shl    $0x3,%eax
c0101461:	29 d0                	sub    %edx,%eax
c0101463:	c1 e0 03             	shl    $0x3,%eax
c0101466:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c010146b:	0f b6 00             	movzbl (%eax),%eax
c010146e:	84 c0                	test   %al,%al
c0101470:	75 24                	jne    c0101496 <ide_write_secs+0x63>
c0101472:	c7 44 24 0c 24 a4 10 	movl   $0xc010a424,0xc(%esp)
c0101479:	c0 
c010147a:	c7 44 24 08 df a3 10 	movl   $0xc010a3df,0x8(%esp)
c0101481:	c0 
c0101482:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c0101489:	00 
c010148a:	c7 04 24 f4 a3 10 c0 	movl   $0xc010a3f4,(%esp)
c0101491:	e8 a7 ef ff ff       	call   c010043d <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c0101496:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c010149d:	77 0f                	ja     c01014ae <ide_write_secs+0x7b>
c010149f:	8b 55 0c             	mov    0xc(%ebp),%edx
c01014a2:	8b 45 14             	mov    0x14(%ebp),%eax
c01014a5:	01 d0                	add    %edx,%eax
c01014a7:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c01014ac:	76 24                	jbe    c01014d2 <ide_write_secs+0x9f>
c01014ae:	c7 44 24 0c 4c a4 10 	movl   $0xc010a44c,0xc(%esp)
c01014b5:	c0 
c01014b6:	c7 44 24 08 df a3 10 	movl   $0xc010a3df,0x8(%esp)
c01014bd:	c0 
c01014be:	c7 44 24 04 bd 00 00 	movl   $0xbd,0x4(%esp)
c01014c5:	00 
c01014c6:	c7 04 24 f4 a3 10 c0 	movl   $0xc010a3f4,(%esp)
c01014cd:	e8 6b ef ff ff       	call   c010043d <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c01014d2:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c01014d6:	d1 e8                	shr    %eax
c01014d8:	0f b7 c0             	movzwl %ax,%eax
c01014db:	8b 04 85 94 a3 10 c0 	mov    -0x3fef5c6c(,%eax,4),%eax
c01014e2:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c01014e6:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c01014ea:	d1 e8                	shr    %eax
c01014ec:	0f b7 c0             	movzwl %ax,%eax
c01014ef:	0f b7 04 85 96 a3 10 	movzwl -0x3fef5c6a(,%eax,4),%eax
c01014f6:	c0 
c01014f7:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c01014fb:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01014ff:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0101506:	00 
c0101507:	89 04 24             	mov    %eax,(%esp)
c010150a:	e8 fa f8 ff ff       	call   c0100e09 <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c010150f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101512:	83 c0 02             	add    $0x2,%eax
c0101515:	0f b7 c0             	movzwl %ax,%eax
c0101518:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c010151c:	c6 45 d5 00          	movb   $0x0,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101520:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101524:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0101528:	ee                   	out    %al,(%dx)
}
c0101529:	90                   	nop
    outb(iobase + ISA_SECCNT, nsecs);
c010152a:	8b 45 14             	mov    0x14(%ebp),%eax
c010152d:	0f b6 c0             	movzbl %al,%eax
c0101530:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101534:	83 c2 02             	add    $0x2,%edx
c0101537:	0f b7 d2             	movzwl %dx,%edx
c010153a:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c010153e:	88 45 d9             	mov    %al,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101541:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101545:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101549:	ee                   	out    %al,(%dx)
}
c010154a:	90                   	nop
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c010154b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010154e:	0f b6 c0             	movzbl %al,%eax
c0101551:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101555:	83 c2 03             	add    $0x3,%edx
c0101558:	0f b7 d2             	movzwl %dx,%edx
c010155b:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c010155f:	88 45 dd             	mov    %al,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101562:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0101566:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c010156a:	ee                   	out    %al,(%dx)
}
c010156b:	90                   	nop
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c010156c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010156f:	c1 e8 08             	shr    $0x8,%eax
c0101572:	0f b6 c0             	movzbl %al,%eax
c0101575:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101579:	83 c2 04             	add    $0x4,%edx
c010157c:	0f b7 d2             	movzwl %dx,%edx
c010157f:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c0101583:	88 45 e1             	mov    %al,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101586:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c010158a:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c010158e:	ee                   	out    %al,(%dx)
}
c010158f:	90                   	nop
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c0101590:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101593:	c1 e8 10             	shr    $0x10,%eax
c0101596:	0f b6 c0             	movzbl %al,%eax
c0101599:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010159d:	83 c2 05             	add    $0x5,%edx
c01015a0:	0f b7 d2             	movzwl %dx,%edx
c01015a3:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c01015a7:	88 45 e5             	mov    %al,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01015aa:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01015ae:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01015b2:	ee                   	out    %al,(%dx)
}
c01015b3:	90                   	nop
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c01015b4:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01015b7:	c0 e0 04             	shl    $0x4,%al
c01015ba:	24 10                	and    $0x10,%al
c01015bc:	88 c2                	mov    %al,%dl
c01015be:	8b 45 0c             	mov    0xc(%ebp),%eax
c01015c1:	c1 e8 18             	shr    $0x18,%eax
c01015c4:	24 0f                	and    $0xf,%al
c01015c6:	08 d0                	or     %dl,%al
c01015c8:	0c e0                	or     $0xe0,%al
c01015ca:	0f b6 c0             	movzbl %al,%eax
c01015cd:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01015d1:	83 c2 06             	add    $0x6,%edx
c01015d4:	0f b7 d2             	movzwl %dx,%edx
c01015d7:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c01015db:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01015de:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01015e2:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01015e6:	ee                   	out    %al,(%dx)
}
c01015e7:	90                   	nop
    outb(iobase + ISA_COMMAND, IDE_CMD_WRITE);
c01015e8:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01015ec:	83 c0 07             	add    $0x7,%eax
c01015ef:	0f b7 c0             	movzwl %ax,%eax
c01015f2:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c01015f6:	c6 45 ed 30          	movb   $0x30,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01015fa:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01015fe:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101602:	ee                   	out    %al,(%dx)
}
c0101603:	90                   	nop

    int ret = 0;
c0101604:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c010160b:	eb 58                	jmp    c0101665 <ide_write_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c010160d:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101611:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0101618:	00 
c0101619:	89 04 24             	mov    %eax,(%esp)
c010161c:	e8 e8 f7 ff ff       	call   c0100e09 <ide_wait_ready>
c0101621:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101624:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101628:	75 43                	jne    c010166d <ide_write_secs+0x23a>
            goto out;
        }
        outsl(iobase, src, SECTSIZE / sizeof(uint32_t));
c010162a:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c010162e:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0101631:	8b 45 10             	mov    0x10(%ebp),%eax
c0101634:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0101637:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    asm volatile (
c010163e:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0101641:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c0101644:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0101647:	89 cb                	mov    %ecx,%ebx
c0101649:	89 de                	mov    %ebx,%esi
c010164b:	89 c1                	mov    %eax,%ecx
c010164d:	fc                   	cld    
c010164e:	f2 6f                	repnz outsl %ds:(%esi),(%dx)
c0101650:	89 c8                	mov    %ecx,%eax
c0101652:	89 f3                	mov    %esi,%ebx
c0101654:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c0101657:	89 45 c8             	mov    %eax,-0x38(%ebp)
}
c010165a:	90                   	nop
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c010165b:	ff 4d 14             	decl   0x14(%ebp)
c010165e:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c0101665:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0101669:	75 a2                	jne    c010160d <ide_write_secs+0x1da>
    }

out:
c010166b:	eb 01                	jmp    c010166e <ide_write_secs+0x23b>
            goto out;
c010166d:	90                   	nop
    return ret;
c010166e:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101671:	83 c4 50             	add    $0x50,%esp
c0101674:	5b                   	pop    %ebx
c0101675:	5e                   	pop    %esi
c0101676:	5d                   	pop    %ebp
c0101677:	c3                   	ret    

c0101678 <clock_init>:
/* *
 * clock_init - initialize 8253 clock to interrupt 100 times per second,
 * and then enable IRQ_TIMER.
 * */
void
clock_init(void) {
c0101678:	f3 0f 1e fb          	endbr32 
c010167c:	55                   	push   %ebp
c010167d:	89 e5                	mov    %esp,%ebp
c010167f:	83 ec 28             	sub    $0x28,%esp
c0101682:	66 c7 45 ee 43 00    	movw   $0x43,-0x12(%ebp)
c0101688:	c6 45 ed 34          	movb   $0x34,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010168c:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101690:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101694:	ee                   	out    %al,(%dx)
}
c0101695:	90                   	nop
c0101696:	66 c7 45 f2 40 00    	movw   $0x40,-0xe(%ebp)
c010169c:	c6 45 f1 9c          	movb   $0x9c,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01016a0:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c01016a4:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01016a8:	ee                   	out    %al,(%dx)
}
c01016a9:	90                   	nop
c01016aa:	66 c7 45 f6 40 00    	movw   $0x40,-0xa(%ebp)
c01016b0:	c6 45 f5 2e          	movb   $0x2e,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01016b4:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c01016b8:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01016bc:	ee                   	out    %al,(%dx)
}
c01016bd:	90                   	nop
    outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
    outb(IO_TIMER1, TIMER_DIV(100) % 256);
    outb(IO_TIMER1, TIMER_DIV(100) / 256);

    // initialize time counter 'ticks' to zero
    ticks = 0;
c01016be:	c7 05 54 e0 12 c0 00 	movl   $0x0,0xc012e054
c01016c5:	00 00 00 

    cprintf("++ setup timer interrupts\n");
c01016c8:	c7 04 24 86 a4 10 c0 	movl   $0xc010a486,(%esp)
c01016cf:	e8 fd eb ff ff       	call   c01002d1 <cprintf>
    pic_enable(IRQ_TIMER);
c01016d4:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01016db:	e8 95 09 00 00       	call   c0102075 <pic_enable>
}
c01016e0:	90                   	nop
c01016e1:	c9                   	leave  
c01016e2:	c3                   	ret    

c01016e3 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c01016e3:	55                   	push   %ebp
c01016e4:	89 e5                	mov    %esp,%ebp
c01016e6:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01016e9:	9c                   	pushf  
c01016ea:	58                   	pop    %eax
c01016eb:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c01016ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c01016f1:	25 00 02 00 00       	and    $0x200,%eax
c01016f6:	85 c0                	test   %eax,%eax
c01016f8:	74 0c                	je     c0101706 <__intr_save+0x23>
        intr_disable();
c01016fa:	e8 05 0b 00 00       	call   c0102204 <intr_disable>
        return 1;
c01016ff:	b8 01 00 00 00       	mov    $0x1,%eax
c0101704:	eb 05                	jmp    c010170b <__intr_save+0x28>
    }
    return 0;
c0101706:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010170b:	c9                   	leave  
c010170c:	c3                   	ret    

c010170d <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c010170d:	55                   	push   %ebp
c010170e:	89 e5                	mov    %esp,%ebp
c0101710:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0101713:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0101717:	74 05                	je     c010171e <__intr_restore+0x11>
        intr_enable();
c0101719:	e8 da 0a 00 00       	call   c01021f8 <intr_enable>
    }
}
c010171e:	90                   	nop
c010171f:	c9                   	leave  
c0101720:	c3                   	ret    

c0101721 <delay>:
#include <memlayout.h>
#include <sync.h>

/* stupid I/O delay routine necessitated by historical PC design flaws */
static void
delay(void) {
c0101721:	f3 0f 1e fb          	endbr32 
c0101725:	55                   	push   %ebp
c0101726:	89 e5                	mov    %esp,%ebp
c0101728:	83 ec 10             	sub    $0x10,%esp
c010172b:	66 c7 45 f2 84 00    	movw   $0x84,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101731:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101735:	89 c2                	mov    %eax,%edx
c0101737:	ec                   	in     (%dx),%al
c0101738:	88 45 f1             	mov    %al,-0xf(%ebp)
c010173b:	66 c7 45 f6 84 00    	movw   $0x84,-0xa(%ebp)
c0101741:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101745:	89 c2                	mov    %eax,%edx
c0101747:	ec                   	in     (%dx),%al
c0101748:	88 45 f5             	mov    %al,-0xb(%ebp)
c010174b:	66 c7 45 fa 84 00    	movw   $0x84,-0x6(%ebp)
c0101751:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101755:	89 c2                	mov    %eax,%edx
c0101757:	ec                   	in     (%dx),%al
c0101758:	88 45 f9             	mov    %al,-0x7(%ebp)
c010175b:	66 c7 45 fe 84 00    	movw   $0x84,-0x2(%ebp)
c0101761:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0101765:	89 c2                	mov    %eax,%edx
c0101767:	ec                   	in     (%dx),%al
c0101768:	88 45 fd             	mov    %al,-0x3(%ebp)
    inb(0x84);
    inb(0x84);
    inb(0x84);
    inb(0x84);
}
c010176b:	90                   	nop
c010176c:	c9                   	leave  
c010176d:	c3                   	ret    

c010176e <cga_init>:
static uint16_t addr_6845;

/* TEXT-mode CGA/VGA display output */

static void
cga_init(void) {
c010176e:	f3 0f 1e fb          	endbr32 
c0101772:	55                   	push   %ebp
c0101773:	89 e5                	mov    %esp,%ebp
c0101775:	83 ec 20             	sub    $0x20,%esp
    volatile uint16_t *cp = (uint16_t *)(CGA_BUF + KERNBASE);
c0101778:	c7 45 fc 00 80 0b c0 	movl   $0xc00b8000,-0x4(%ebp)
    uint16_t was = *cp;
c010177f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101782:	0f b7 00             	movzwl (%eax),%eax
c0101785:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
    *cp = (uint16_t) 0xA55A;
c0101789:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010178c:	66 c7 00 5a a5       	movw   $0xa55a,(%eax)
    if (*cp != 0xA55A) {
c0101791:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101794:	0f b7 00             	movzwl (%eax),%eax
c0101797:	0f b7 c0             	movzwl %ax,%eax
c010179a:	3d 5a a5 00 00       	cmp    $0xa55a,%eax
c010179f:	74 12                	je     c01017b3 <cga_init+0x45>
        cp = (uint16_t*)(MONO_BUF + KERNBASE);
c01017a1:	c7 45 fc 00 00 0b c0 	movl   $0xc00b0000,-0x4(%ebp)
        addr_6845 = MONO_BASE;
c01017a8:	66 c7 05 26 b5 12 c0 	movw   $0x3b4,0xc012b526
c01017af:	b4 03 
c01017b1:	eb 13                	jmp    c01017c6 <cga_init+0x58>
    } else {
        *cp = was;
c01017b3:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01017b6:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c01017ba:	66 89 10             	mov    %dx,(%eax)
        addr_6845 = CGA_BASE;
c01017bd:	66 c7 05 26 b5 12 c0 	movw   $0x3d4,0xc012b526
c01017c4:	d4 03 
    }

    // Extract cursor location
    uint32_t pos;
    outb(addr_6845, 14);
c01017c6:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c01017cd:	66 89 45 e6          	mov    %ax,-0x1a(%ebp)
c01017d1:	c6 45 e5 0e          	movb   $0xe,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01017d5:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01017d9:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01017dd:	ee                   	out    %al,(%dx)
}
c01017de:	90                   	nop
    pos = inb(addr_6845 + 1) << 8;
c01017df:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c01017e6:	40                   	inc    %eax
c01017e7:	0f b7 c0             	movzwl %ax,%eax
c01017ea:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01017ee:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01017f2:	89 c2                	mov    %eax,%edx
c01017f4:	ec                   	in     (%dx),%al
c01017f5:	88 45 e9             	mov    %al,-0x17(%ebp)
    return data;
c01017f8:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01017fc:	0f b6 c0             	movzbl %al,%eax
c01017ff:	c1 e0 08             	shl    $0x8,%eax
c0101802:	89 45 f4             	mov    %eax,-0xc(%ebp)
    outb(addr_6845, 15);
c0101805:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c010180c:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101810:	c6 45 ed 0f          	movb   $0xf,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101814:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101818:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c010181c:	ee                   	out    %al,(%dx)
}
c010181d:	90                   	nop
    pos |= inb(addr_6845 + 1);
c010181e:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c0101825:	40                   	inc    %eax
c0101826:	0f b7 c0             	movzwl %ax,%eax
c0101829:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010182d:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101831:	89 c2                	mov    %eax,%edx
c0101833:	ec                   	in     (%dx),%al
c0101834:	88 45 f1             	mov    %al,-0xf(%ebp)
    return data;
c0101837:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c010183b:	0f b6 c0             	movzbl %al,%eax
c010183e:	09 45 f4             	or     %eax,-0xc(%ebp)

    crt_buf = (uint16_t*) cp;
c0101841:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101844:	a3 20 b5 12 c0       	mov    %eax,0xc012b520
    crt_pos = pos;
c0101849:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010184c:	0f b7 c0             	movzwl %ax,%eax
c010184f:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
}
c0101855:	90                   	nop
c0101856:	c9                   	leave  
c0101857:	c3                   	ret    

c0101858 <serial_init>:

static bool serial_exists = 0;

static void
serial_init(void) {
c0101858:	f3 0f 1e fb          	endbr32 
c010185c:	55                   	push   %ebp
c010185d:	89 e5                	mov    %esp,%ebp
c010185f:	83 ec 48             	sub    $0x48,%esp
c0101862:	66 c7 45 d2 fa 03    	movw   $0x3fa,-0x2e(%ebp)
c0101868:	c6 45 d1 00          	movb   $0x0,-0x2f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010186c:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c0101870:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c0101874:	ee                   	out    %al,(%dx)
}
c0101875:	90                   	nop
c0101876:	66 c7 45 d6 fb 03    	movw   $0x3fb,-0x2a(%ebp)
c010187c:	c6 45 d5 80          	movb   $0x80,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101880:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101884:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0101888:	ee                   	out    %al,(%dx)
}
c0101889:	90                   	nop
c010188a:	66 c7 45 da f8 03    	movw   $0x3f8,-0x26(%ebp)
c0101890:	c6 45 d9 0c          	movb   $0xc,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101894:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101898:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c010189c:	ee                   	out    %al,(%dx)
}
c010189d:	90                   	nop
c010189e:	66 c7 45 de f9 03    	movw   $0x3f9,-0x22(%ebp)
c01018a4:	c6 45 dd 00          	movb   $0x0,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01018a8:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c01018ac:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c01018b0:	ee                   	out    %al,(%dx)
}
c01018b1:	90                   	nop
c01018b2:	66 c7 45 e2 fb 03    	movw   $0x3fb,-0x1e(%ebp)
c01018b8:	c6 45 e1 03          	movb   $0x3,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01018bc:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c01018c0:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c01018c4:	ee                   	out    %al,(%dx)
}
c01018c5:	90                   	nop
c01018c6:	66 c7 45 e6 fc 03    	movw   $0x3fc,-0x1a(%ebp)
c01018cc:	c6 45 e5 00          	movb   $0x0,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01018d0:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01018d4:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01018d8:	ee                   	out    %al,(%dx)
}
c01018d9:	90                   	nop
c01018da:	66 c7 45 ea f9 03    	movw   $0x3f9,-0x16(%ebp)
c01018e0:	c6 45 e9 01          	movb   $0x1,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01018e4:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01018e8:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01018ec:	ee                   	out    %al,(%dx)
}
c01018ed:	90                   	nop
c01018ee:	66 c7 45 ee fd 03    	movw   $0x3fd,-0x12(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01018f4:	0f b7 45 ee          	movzwl -0x12(%ebp),%eax
c01018f8:	89 c2                	mov    %eax,%edx
c01018fa:	ec                   	in     (%dx),%al
c01018fb:	88 45 ed             	mov    %al,-0x13(%ebp)
    return data;
c01018fe:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
    // Enable rcv interrupts
    outb(COM1 + COM_IER, COM_IER_RDI);

    // Clear any preexisting overrun indications and interrupts
    // Serial port doesn't exist if COM_LSR returns 0xFF
    serial_exists = (inb(COM1 + COM_LSR) != 0xFF);
c0101902:	3c ff                	cmp    $0xff,%al
c0101904:	0f 95 c0             	setne  %al
c0101907:	0f b6 c0             	movzbl %al,%eax
c010190a:	a3 28 b5 12 c0       	mov    %eax,0xc012b528
c010190f:	66 c7 45 f2 fa 03    	movw   $0x3fa,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101915:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101919:	89 c2                	mov    %eax,%edx
c010191b:	ec                   	in     (%dx),%al
c010191c:	88 45 f1             	mov    %al,-0xf(%ebp)
c010191f:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
c0101925:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101929:	89 c2                	mov    %eax,%edx
c010192b:	ec                   	in     (%dx),%al
c010192c:	88 45 f5             	mov    %al,-0xb(%ebp)
    (void) inb(COM1+COM_IIR);
    (void) inb(COM1+COM_RX);

    if (serial_exists) {
c010192f:	a1 28 b5 12 c0       	mov    0xc012b528,%eax
c0101934:	85 c0                	test   %eax,%eax
c0101936:	74 0c                	je     c0101944 <serial_init+0xec>
        pic_enable(IRQ_COM1);
c0101938:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c010193f:	e8 31 07 00 00       	call   c0102075 <pic_enable>
    }
}
c0101944:	90                   	nop
c0101945:	c9                   	leave  
c0101946:	c3                   	ret    

c0101947 <lpt_putc_sub>:

static void
lpt_putc_sub(int c) {
c0101947:	f3 0f 1e fb          	endbr32 
c010194b:	55                   	push   %ebp
c010194c:	89 e5                	mov    %esp,%ebp
c010194e:	83 ec 20             	sub    $0x20,%esp
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0101951:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c0101958:	eb 08                	jmp    c0101962 <lpt_putc_sub+0x1b>
        delay();
c010195a:	e8 c2 fd ff ff       	call   c0101721 <delay>
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c010195f:	ff 45 fc             	incl   -0x4(%ebp)
c0101962:	66 c7 45 fa 79 03    	movw   $0x379,-0x6(%ebp)
c0101968:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c010196c:	89 c2                	mov    %eax,%edx
c010196e:	ec                   	in     (%dx),%al
c010196f:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101972:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101976:	84 c0                	test   %al,%al
c0101978:	78 09                	js     c0101983 <lpt_putc_sub+0x3c>
c010197a:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c0101981:	7e d7                	jle    c010195a <lpt_putc_sub+0x13>
    }
    outb(LPTPORT + 0, c);
c0101983:	8b 45 08             	mov    0x8(%ebp),%eax
c0101986:	0f b6 c0             	movzbl %al,%eax
c0101989:	66 c7 45 ee 78 03    	movw   $0x378,-0x12(%ebp)
c010198f:	88 45 ed             	mov    %al,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101992:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101996:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c010199a:	ee                   	out    %al,(%dx)
}
c010199b:	90                   	nop
c010199c:	66 c7 45 f2 7a 03    	movw   $0x37a,-0xe(%ebp)
c01019a2:	c6 45 f1 0d          	movb   $0xd,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01019a6:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c01019aa:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01019ae:	ee                   	out    %al,(%dx)
}
c01019af:	90                   	nop
c01019b0:	66 c7 45 f6 7a 03    	movw   $0x37a,-0xa(%ebp)
c01019b6:	c6 45 f5 08          	movb   $0x8,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01019ba:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c01019be:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01019c2:	ee                   	out    %al,(%dx)
}
c01019c3:	90                   	nop
    outb(LPTPORT + 2, 0x08 | 0x04 | 0x01);
    outb(LPTPORT + 2, 0x08);
}
c01019c4:	90                   	nop
c01019c5:	c9                   	leave  
c01019c6:	c3                   	ret    

c01019c7 <lpt_putc>:

/* lpt_putc - copy console output to parallel port */
static void
lpt_putc(int c) {
c01019c7:	f3 0f 1e fb          	endbr32 
c01019cb:	55                   	push   %ebp
c01019cc:	89 e5                	mov    %esp,%ebp
c01019ce:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c01019d1:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c01019d5:	74 0d                	je     c01019e4 <lpt_putc+0x1d>
        lpt_putc_sub(c);
c01019d7:	8b 45 08             	mov    0x8(%ebp),%eax
c01019da:	89 04 24             	mov    %eax,(%esp)
c01019dd:	e8 65 ff ff ff       	call   c0101947 <lpt_putc_sub>
    else {
        lpt_putc_sub('\b');
        lpt_putc_sub(' ');
        lpt_putc_sub('\b');
    }
}
c01019e2:	eb 24                	jmp    c0101a08 <lpt_putc+0x41>
        lpt_putc_sub('\b');
c01019e4:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c01019eb:	e8 57 ff ff ff       	call   c0101947 <lpt_putc_sub>
        lpt_putc_sub(' ');
c01019f0:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c01019f7:	e8 4b ff ff ff       	call   c0101947 <lpt_putc_sub>
        lpt_putc_sub('\b');
c01019fc:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101a03:	e8 3f ff ff ff       	call   c0101947 <lpt_putc_sub>
}
c0101a08:	90                   	nop
c0101a09:	c9                   	leave  
c0101a0a:	c3                   	ret    

c0101a0b <cga_putc>:

/* cga_putc - print character to console */
static void
cga_putc(int c) {
c0101a0b:	f3 0f 1e fb          	endbr32 
c0101a0f:	55                   	push   %ebp
c0101a10:	89 e5                	mov    %esp,%ebp
c0101a12:	53                   	push   %ebx
c0101a13:	83 ec 34             	sub    $0x34,%esp
    // set black on white
    if (!(c & ~0xFF)) {
c0101a16:	8b 45 08             	mov    0x8(%ebp),%eax
c0101a19:	25 00 ff ff ff       	and    $0xffffff00,%eax
c0101a1e:	85 c0                	test   %eax,%eax
c0101a20:	75 07                	jne    c0101a29 <cga_putc+0x1e>
        c |= 0x0700;
c0101a22:	81 4d 08 00 07 00 00 	orl    $0x700,0x8(%ebp)
    }

    switch (c & 0xff) {
c0101a29:	8b 45 08             	mov    0x8(%ebp),%eax
c0101a2c:	0f b6 c0             	movzbl %al,%eax
c0101a2f:	83 f8 0d             	cmp    $0xd,%eax
c0101a32:	74 72                	je     c0101aa6 <cga_putc+0x9b>
c0101a34:	83 f8 0d             	cmp    $0xd,%eax
c0101a37:	0f 8f a3 00 00 00    	jg     c0101ae0 <cga_putc+0xd5>
c0101a3d:	83 f8 08             	cmp    $0x8,%eax
c0101a40:	74 0a                	je     c0101a4c <cga_putc+0x41>
c0101a42:	83 f8 0a             	cmp    $0xa,%eax
c0101a45:	74 4c                	je     c0101a93 <cga_putc+0x88>
c0101a47:	e9 94 00 00 00       	jmp    c0101ae0 <cga_putc+0xd5>
    case '\b':
        if (crt_pos > 0) {
c0101a4c:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101a53:	85 c0                	test   %eax,%eax
c0101a55:	0f 84 af 00 00 00    	je     c0101b0a <cga_putc+0xff>
            crt_pos --;
c0101a5b:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101a62:	48                   	dec    %eax
c0101a63:	0f b7 c0             	movzwl %ax,%eax
c0101a66:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
            crt_buf[crt_pos] = (c & ~0xff) | ' ';
c0101a6c:	8b 45 08             	mov    0x8(%ebp),%eax
c0101a6f:	98                   	cwtl   
c0101a70:	25 00 ff ff ff       	and    $0xffffff00,%eax
c0101a75:	98                   	cwtl   
c0101a76:	83 c8 20             	or     $0x20,%eax
c0101a79:	98                   	cwtl   
c0101a7a:	8b 15 20 b5 12 c0    	mov    0xc012b520,%edx
c0101a80:	0f b7 0d 24 b5 12 c0 	movzwl 0xc012b524,%ecx
c0101a87:	01 c9                	add    %ecx,%ecx
c0101a89:	01 ca                	add    %ecx,%edx
c0101a8b:	0f b7 c0             	movzwl %ax,%eax
c0101a8e:	66 89 02             	mov    %ax,(%edx)
        }
        break;
c0101a91:	eb 77                	jmp    c0101b0a <cga_putc+0xff>
    case '\n':
        crt_pos += CRT_COLS;
c0101a93:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101a9a:	83 c0 50             	add    $0x50,%eax
c0101a9d:	0f b7 c0             	movzwl %ax,%eax
c0101aa0:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
    case '\r':
        crt_pos -= (crt_pos % CRT_COLS);
c0101aa6:	0f b7 1d 24 b5 12 c0 	movzwl 0xc012b524,%ebx
c0101aad:	0f b7 0d 24 b5 12 c0 	movzwl 0xc012b524,%ecx
c0101ab4:	ba cd cc cc cc       	mov    $0xcccccccd,%edx
c0101ab9:	89 c8                	mov    %ecx,%eax
c0101abb:	f7 e2                	mul    %edx
c0101abd:	c1 ea 06             	shr    $0x6,%edx
c0101ac0:	89 d0                	mov    %edx,%eax
c0101ac2:	c1 e0 02             	shl    $0x2,%eax
c0101ac5:	01 d0                	add    %edx,%eax
c0101ac7:	c1 e0 04             	shl    $0x4,%eax
c0101aca:	29 c1                	sub    %eax,%ecx
c0101acc:	89 c8                	mov    %ecx,%eax
c0101ace:	0f b7 c0             	movzwl %ax,%eax
c0101ad1:	29 c3                	sub    %eax,%ebx
c0101ad3:	89 d8                	mov    %ebx,%eax
c0101ad5:	0f b7 c0             	movzwl %ax,%eax
c0101ad8:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
        break;
c0101ade:	eb 2b                	jmp    c0101b0b <cga_putc+0x100>
    default:
        crt_buf[crt_pos ++] = c;     // write the character
c0101ae0:	8b 0d 20 b5 12 c0    	mov    0xc012b520,%ecx
c0101ae6:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101aed:	8d 50 01             	lea    0x1(%eax),%edx
c0101af0:	0f b7 d2             	movzwl %dx,%edx
c0101af3:	66 89 15 24 b5 12 c0 	mov    %dx,0xc012b524
c0101afa:	01 c0                	add    %eax,%eax
c0101afc:	8d 14 01             	lea    (%ecx,%eax,1),%edx
c0101aff:	8b 45 08             	mov    0x8(%ebp),%eax
c0101b02:	0f b7 c0             	movzwl %ax,%eax
c0101b05:	66 89 02             	mov    %ax,(%edx)
        break;
c0101b08:	eb 01                	jmp    c0101b0b <cga_putc+0x100>
        break;
c0101b0a:	90                   	nop
    }

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
c0101b0b:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101b12:	3d cf 07 00 00       	cmp    $0x7cf,%eax
c0101b17:	76 5d                	jbe    c0101b76 <cga_putc+0x16b>
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
c0101b19:	a1 20 b5 12 c0       	mov    0xc012b520,%eax
c0101b1e:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
c0101b24:	a1 20 b5 12 c0       	mov    0xc012b520,%eax
c0101b29:	c7 44 24 08 00 0f 00 	movl   $0xf00,0x8(%esp)
c0101b30:	00 
c0101b31:	89 54 24 04          	mov    %edx,0x4(%esp)
c0101b35:	89 04 24             	mov    %eax,(%esp)
c0101b38:	e8 3e 7c 00 00       	call   c010977b <memmove>
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101b3d:	c7 45 f4 80 07 00 00 	movl   $0x780,-0xc(%ebp)
c0101b44:	eb 14                	jmp    c0101b5a <cga_putc+0x14f>
            crt_buf[i] = 0x0700 | ' ';
c0101b46:	a1 20 b5 12 c0       	mov    0xc012b520,%eax
c0101b4b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101b4e:	01 d2                	add    %edx,%edx
c0101b50:	01 d0                	add    %edx,%eax
c0101b52:	66 c7 00 20 07       	movw   $0x720,(%eax)
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101b57:	ff 45 f4             	incl   -0xc(%ebp)
c0101b5a:	81 7d f4 cf 07 00 00 	cmpl   $0x7cf,-0xc(%ebp)
c0101b61:	7e e3                	jle    c0101b46 <cga_putc+0x13b>
        }
        crt_pos -= CRT_COLS;
c0101b63:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101b6a:	83 e8 50             	sub    $0x50,%eax
c0101b6d:	0f b7 c0             	movzwl %ax,%eax
c0101b70:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
    }

    // move that little blinky thing
    outb(addr_6845, 14);
c0101b76:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c0101b7d:	66 89 45 e6          	mov    %ax,-0x1a(%ebp)
c0101b81:	c6 45 e5 0e          	movb   $0xe,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101b85:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101b89:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101b8d:	ee                   	out    %al,(%dx)
}
c0101b8e:	90                   	nop
    outb(addr_6845 + 1, crt_pos >> 8);
c0101b8f:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101b96:	c1 e8 08             	shr    $0x8,%eax
c0101b99:	0f b7 c0             	movzwl %ax,%eax
c0101b9c:	0f b6 c0             	movzbl %al,%eax
c0101b9f:	0f b7 15 26 b5 12 c0 	movzwl 0xc012b526,%edx
c0101ba6:	42                   	inc    %edx
c0101ba7:	0f b7 d2             	movzwl %dx,%edx
c0101baa:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101bae:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101bb1:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101bb5:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101bb9:	ee                   	out    %al,(%dx)
}
c0101bba:	90                   	nop
    outb(addr_6845, 15);
c0101bbb:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c0101bc2:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101bc6:	c6 45 ed 0f          	movb   $0xf,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101bca:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101bce:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101bd2:	ee                   	out    %al,(%dx)
}
c0101bd3:	90                   	nop
    outb(addr_6845 + 1, crt_pos);
c0101bd4:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101bdb:	0f b6 c0             	movzbl %al,%eax
c0101bde:	0f b7 15 26 b5 12 c0 	movzwl 0xc012b526,%edx
c0101be5:	42                   	inc    %edx
c0101be6:	0f b7 d2             	movzwl %dx,%edx
c0101be9:	66 89 55 f2          	mov    %dx,-0xe(%ebp)
c0101bed:	88 45 f1             	mov    %al,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101bf0:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0101bf4:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101bf8:	ee                   	out    %al,(%dx)
}
c0101bf9:	90                   	nop
}
c0101bfa:	90                   	nop
c0101bfb:	83 c4 34             	add    $0x34,%esp
c0101bfe:	5b                   	pop    %ebx
c0101bff:	5d                   	pop    %ebp
c0101c00:	c3                   	ret    

c0101c01 <serial_putc_sub>:

static void
serial_putc_sub(int c) {
c0101c01:	f3 0f 1e fb          	endbr32 
c0101c05:	55                   	push   %ebp
c0101c06:	89 e5                	mov    %esp,%ebp
c0101c08:	83 ec 10             	sub    $0x10,%esp
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c0101c0b:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c0101c12:	eb 08                	jmp    c0101c1c <serial_putc_sub+0x1b>
        delay();
c0101c14:	e8 08 fb ff ff       	call   c0101721 <delay>
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c0101c19:	ff 45 fc             	incl   -0x4(%ebp)
c0101c1c:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101c22:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101c26:	89 c2                	mov    %eax,%edx
c0101c28:	ec                   	in     (%dx),%al
c0101c29:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101c2c:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101c30:	0f b6 c0             	movzbl %al,%eax
c0101c33:	83 e0 20             	and    $0x20,%eax
c0101c36:	85 c0                	test   %eax,%eax
c0101c38:	75 09                	jne    c0101c43 <serial_putc_sub+0x42>
c0101c3a:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c0101c41:	7e d1                	jle    c0101c14 <serial_putc_sub+0x13>
    }
    outb(COM1 + COM_TX, c);
c0101c43:	8b 45 08             	mov    0x8(%ebp),%eax
c0101c46:	0f b6 c0             	movzbl %al,%eax
c0101c49:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
c0101c4f:	88 45 f5             	mov    %al,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101c52:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101c56:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101c5a:	ee                   	out    %al,(%dx)
}
c0101c5b:	90                   	nop
}
c0101c5c:	90                   	nop
c0101c5d:	c9                   	leave  
c0101c5e:	c3                   	ret    

c0101c5f <serial_putc>:

/* serial_putc - print character to serial port */
static void
serial_putc(int c) {
c0101c5f:	f3 0f 1e fb          	endbr32 
c0101c63:	55                   	push   %ebp
c0101c64:	89 e5                	mov    %esp,%ebp
c0101c66:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c0101c69:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c0101c6d:	74 0d                	je     c0101c7c <serial_putc+0x1d>
        serial_putc_sub(c);
c0101c6f:	8b 45 08             	mov    0x8(%ebp),%eax
c0101c72:	89 04 24             	mov    %eax,(%esp)
c0101c75:	e8 87 ff ff ff       	call   c0101c01 <serial_putc_sub>
    else {
        serial_putc_sub('\b');
        serial_putc_sub(' ');
        serial_putc_sub('\b');
    }
}
c0101c7a:	eb 24                	jmp    c0101ca0 <serial_putc+0x41>
        serial_putc_sub('\b');
c0101c7c:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101c83:	e8 79 ff ff ff       	call   c0101c01 <serial_putc_sub>
        serial_putc_sub(' ');
c0101c88:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0101c8f:	e8 6d ff ff ff       	call   c0101c01 <serial_putc_sub>
        serial_putc_sub('\b');
c0101c94:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101c9b:	e8 61 ff ff ff       	call   c0101c01 <serial_putc_sub>
}
c0101ca0:	90                   	nop
c0101ca1:	c9                   	leave  
c0101ca2:	c3                   	ret    

c0101ca3 <cons_intr>:
/* *
 * cons_intr - called by device interrupt routines to feed input
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
c0101ca3:	f3 0f 1e fb          	endbr32 
c0101ca7:	55                   	push   %ebp
c0101ca8:	89 e5                	mov    %esp,%ebp
c0101caa:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = (*proc)()) != -1) {
c0101cad:	eb 33                	jmp    c0101ce2 <cons_intr+0x3f>
        if (c != 0) {
c0101caf:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101cb3:	74 2d                	je     c0101ce2 <cons_intr+0x3f>
            cons.buf[cons.wpos ++] = c;
c0101cb5:	a1 44 b7 12 c0       	mov    0xc012b744,%eax
c0101cba:	8d 50 01             	lea    0x1(%eax),%edx
c0101cbd:	89 15 44 b7 12 c0    	mov    %edx,0xc012b744
c0101cc3:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101cc6:	88 90 40 b5 12 c0    	mov    %dl,-0x3fed4ac0(%eax)
            if (cons.wpos == CONSBUFSIZE) {
c0101ccc:	a1 44 b7 12 c0       	mov    0xc012b744,%eax
c0101cd1:	3d 00 02 00 00       	cmp    $0x200,%eax
c0101cd6:	75 0a                	jne    c0101ce2 <cons_intr+0x3f>
                cons.wpos = 0;
c0101cd8:	c7 05 44 b7 12 c0 00 	movl   $0x0,0xc012b744
c0101cdf:	00 00 00 
    while ((c = (*proc)()) != -1) {
c0101ce2:	8b 45 08             	mov    0x8(%ebp),%eax
c0101ce5:	ff d0                	call   *%eax
c0101ce7:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101cea:	83 7d f4 ff          	cmpl   $0xffffffff,-0xc(%ebp)
c0101cee:	75 bf                	jne    c0101caf <cons_intr+0xc>
            }
        }
    }
}
c0101cf0:	90                   	nop
c0101cf1:	90                   	nop
c0101cf2:	c9                   	leave  
c0101cf3:	c3                   	ret    

c0101cf4 <serial_proc_data>:

/* serial_proc_data - get data from serial port */
static int
serial_proc_data(void) {
c0101cf4:	f3 0f 1e fb          	endbr32 
c0101cf8:	55                   	push   %ebp
c0101cf9:	89 e5                	mov    %esp,%ebp
c0101cfb:	83 ec 10             	sub    $0x10,%esp
c0101cfe:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101d04:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101d08:	89 c2                	mov    %eax,%edx
c0101d0a:	ec                   	in     (%dx),%al
c0101d0b:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101d0e:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
    if (!(inb(COM1 + COM_LSR) & COM_LSR_DATA)) {
c0101d12:	0f b6 c0             	movzbl %al,%eax
c0101d15:	83 e0 01             	and    $0x1,%eax
c0101d18:	85 c0                	test   %eax,%eax
c0101d1a:	75 07                	jne    c0101d23 <serial_proc_data+0x2f>
        return -1;
c0101d1c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101d21:	eb 2a                	jmp    c0101d4d <serial_proc_data+0x59>
c0101d23:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101d29:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101d2d:	89 c2                	mov    %eax,%edx
c0101d2f:	ec                   	in     (%dx),%al
c0101d30:	88 45 f5             	mov    %al,-0xb(%ebp)
    return data;
c0101d33:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
    }
    int c = inb(COM1 + COM_RX);
c0101d37:	0f b6 c0             	movzbl %al,%eax
c0101d3a:	89 45 fc             	mov    %eax,-0x4(%ebp)
    if (c == 127) {
c0101d3d:	83 7d fc 7f          	cmpl   $0x7f,-0x4(%ebp)
c0101d41:	75 07                	jne    c0101d4a <serial_proc_data+0x56>
        c = '\b';
c0101d43:	c7 45 fc 08 00 00 00 	movl   $0x8,-0x4(%ebp)
    }
    return c;
c0101d4a:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0101d4d:	c9                   	leave  
c0101d4e:	c3                   	ret    

c0101d4f <serial_intr>:

/* serial_intr - try to feed input characters from serial port */
void
serial_intr(void) {
c0101d4f:	f3 0f 1e fb          	endbr32 
c0101d53:	55                   	push   %ebp
c0101d54:	89 e5                	mov    %esp,%ebp
c0101d56:	83 ec 18             	sub    $0x18,%esp
    if (serial_exists) {
c0101d59:	a1 28 b5 12 c0       	mov    0xc012b528,%eax
c0101d5e:	85 c0                	test   %eax,%eax
c0101d60:	74 0c                	je     c0101d6e <serial_intr+0x1f>
        cons_intr(serial_proc_data);
c0101d62:	c7 04 24 f4 1c 10 c0 	movl   $0xc0101cf4,(%esp)
c0101d69:	e8 35 ff ff ff       	call   c0101ca3 <cons_intr>
    }
}
c0101d6e:	90                   	nop
c0101d6f:	c9                   	leave  
c0101d70:	c3                   	ret    

c0101d71 <kbd_proc_data>:
 *
 * The kbd_proc_data() function gets data from the keyboard.
 * If we finish a character, return it, else 0. And return -1 if no data.
 * */
static int
kbd_proc_data(void) {
c0101d71:	f3 0f 1e fb          	endbr32 
c0101d75:	55                   	push   %ebp
c0101d76:	89 e5                	mov    %esp,%ebp
c0101d78:	83 ec 38             	sub    $0x38,%esp
c0101d7b:	66 c7 45 f0 64 00    	movw   $0x64,-0x10(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101d81:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101d84:	89 c2                	mov    %eax,%edx
c0101d86:	ec                   	in     (%dx),%al
c0101d87:	88 45 ef             	mov    %al,-0x11(%ebp)
    return data;
c0101d8a:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
    int c;
    uint8_t data;
    static uint32_t shift;

    if ((inb(KBSTATP) & KBS_DIB) == 0) {
c0101d8e:	0f b6 c0             	movzbl %al,%eax
c0101d91:	83 e0 01             	and    $0x1,%eax
c0101d94:	85 c0                	test   %eax,%eax
c0101d96:	75 0a                	jne    c0101da2 <kbd_proc_data+0x31>
        return -1;
c0101d98:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101d9d:	e9 56 01 00 00       	jmp    c0101ef8 <kbd_proc_data+0x187>
c0101da2:	66 c7 45 ec 60 00    	movw   $0x60,-0x14(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101da8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101dab:	89 c2                	mov    %eax,%edx
c0101dad:	ec                   	in     (%dx),%al
c0101dae:	88 45 eb             	mov    %al,-0x15(%ebp)
    return data;
c0101db1:	0f b6 45 eb          	movzbl -0x15(%ebp),%eax
    }

    data = inb(KBDATAP);
c0101db5:	88 45 f3             	mov    %al,-0xd(%ebp)

    if (data == 0xE0) {
c0101db8:	80 7d f3 e0          	cmpb   $0xe0,-0xd(%ebp)
c0101dbc:	75 17                	jne    c0101dd5 <kbd_proc_data+0x64>
        // E0 escape character
        shift |= E0ESC;
c0101dbe:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101dc3:	83 c8 40             	or     $0x40,%eax
c0101dc6:	a3 48 b7 12 c0       	mov    %eax,0xc012b748
        return 0;
c0101dcb:	b8 00 00 00 00       	mov    $0x0,%eax
c0101dd0:	e9 23 01 00 00       	jmp    c0101ef8 <kbd_proc_data+0x187>
    } else if (data & 0x80) {
c0101dd5:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101dd9:	84 c0                	test   %al,%al
c0101ddb:	79 45                	jns    c0101e22 <kbd_proc_data+0xb1>
        // Key released
        data = (shift & E0ESC ? data : data & 0x7F);
c0101ddd:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101de2:	83 e0 40             	and    $0x40,%eax
c0101de5:	85 c0                	test   %eax,%eax
c0101de7:	75 08                	jne    c0101df1 <kbd_proc_data+0x80>
c0101de9:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101ded:	24 7f                	and    $0x7f,%al
c0101def:	eb 04                	jmp    c0101df5 <kbd_proc_data+0x84>
c0101df1:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101df5:	88 45 f3             	mov    %al,-0xd(%ebp)
        shift &= ~(shiftcode[data] | E0ESC);
c0101df8:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101dfc:	0f b6 80 40 80 12 c0 	movzbl -0x3fed7fc0(%eax),%eax
c0101e03:	0c 40                	or     $0x40,%al
c0101e05:	0f b6 c0             	movzbl %al,%eax
c0101e08:	f7 d0                	not    %eax
c0101e0a:	89 c2                	mov    %eax,%edx
c0101e0c:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101e11:	21 d0                	and    %edx,%eax
c0101e13:	a3 48 b7 12 c0       	mov    %eax,0xc012b748
        return 0;
c0101e18:	b8 00 00 00 00       	mov    $0x0,%eax
c0101e1d:	e9 d6 00 00 00       	jmp    c0101ef8 <kbd_proc_data+0x187>
    } else if (shift & E0ESC) {
c0101e22:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101e27:	83 e0 40             	and    $0x40,%eax
c0101e2a:	85 c0                	test   %eax,%eax
c0101e2c:	74 11                	je     c0101e3f <kbd_proc_data+0xce>
        // Last character was an E0 escape; or with 0x80
        data |= 0x80;
c0101e2e:	80 4d f3 80          	orb    $0x80,-0xd(%ebp)
        shift &= ~E0ESC;
c0101e32:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101e37:	83 e0 bf             	and    $0xffffffbf,%eax
c0101e3a:	a3 48 b7 12 c0       	mov    %eax,0xc012b748
    }

    shift |= shiftcode[data];
c0101e3f:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101e43:	0f b6 80 40 80 12 c0 	movzbl -0x3fed7fc0(%eax),%eax
c0101e4a:	0f b6 d0             	movzbl %al,%edx
c0101e4d:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101e52:	09 d0                	or     %edx,%eax
c0101e54:	a3 48 b7 12 c0       	mov    %eax,0xc012b748
    shift ^= togglecode[data];
c0101e59:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101e5d:	0f b6 80 40 81 12 c0 	movzbl -0x3fed7ec0(%eax),%eax
c0101e64:	0f b6 d0             	movzbl %al,%edx
c0101e67:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101e6c:	31 d0                	xor    %edx,%eax
c0101e6e:	a3 48 b7 12 c0       	mov    %eax,0xc012b748

    c = charcode[shift & (CTL | SHIFT)][data];
c0101e73:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101e78:	83 e0 03             	and    $0x3,%eax
c0101e7b:	8b 14 85 40 85 12 c0 	mov    -0x3fed7ac0(,%eax,4),%edx
c0101e82:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101e86:	01 d0                	add    %edx,%eax
c0101e88:	0f b6 00             	movzbl (%eax),%eax
c0101e8b:	0f b6 c0             	movzbl %al,%eax
c0101e8e:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (shift & CAPSLOCK) {
c0101e91:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101e96:	83 e0 08             	and    $0x8,%eax
c0101e99:	85 c0                	test   %eax,%eax
c0101e9b:	74 22                	je     c0101ebf <kbd_proc_data+0x14e>
        if ('a' <= c && c <= 'z')
c0101e9d:	83 7d f4 60          	cmpl   $0x60,-0xc(%ebp)
c0101ea1:	7e 0c                	jle    c0101eaf <kbd_proc_data+0x13e>
c0101ea3:	83 7d f4 7a          	cmpl   $0x7a,-0xc(%ebp)
c0101ea7:	7f 06                	jg     c0101eaf <kbd_proc_data+0x13e>
            c += 'A' - 'a';
c0101ea9:	83 6d f4 20          	subl   $0x20,-0xc(%ebp)
c0101ead:	eb 10                	jmp    c0101ebf <kbd_proc_data+0x14e>
        else if ('A' <= c && c <= 'Z')
c0101eaf:	83 7d f4 40          	cmpl   $0x40,-0xc(%ebp)
c0101eb3:	7e 0a                	jle    c0101ebf <kbd_proc_data+0x14e>
c0101eb5:	83 7d f4 5a          	cmpl   $0x5a,-0xc(%ebp)
c0101eb9:	7f 04                	jg     c0101ebf <kbd_proc_data+0x14e>
            c += 'a' - 'A';
c0101ebb:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
    }

    // Process special keys
    // Ctrl-Alt-Del: reboot
    if (!(~shift & (CTL | ALT)) && c == KEY_DEL) {
c0101ebf:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101ec4:	f7 d0                	not    %eax
c0101ec6:	83 e0 06             	and    $0x6,%eax
c0101ec9:	85 c0                	test   %eax,%eax
c0101ecb:	75 28                	jne    c0101ef5 <kbd_proc_data+0x184>
c0101ecd:	81 7d f4 e9 00 00 00 	cmpl   $0xe9,-0xc(%ebp)
c0101ed4:	75 1f                	jne    c0101ef5 <kbd_proc_data+0x184>
        cprintf("Rebooting!\n");
c0101ed6:	c7 04 24 a1 a4 10 c0 	movl   $0xc010a4a1,(%esp)
c0101edd:	e8 ef e3 ff ff       	call   c01002d1 <cprintf>
c0101ee2:	66 c7 45 e8 92 00    	movw   $0x92,-0x18(%ebp)
c0101ee8:	c6 45 e7 03          	movb   $0x3,-0x19(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101eec:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
c0101ef0:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0101ef3:	ee                   	out    %al,(%dx)
}
c0101ef4:	90                   	nop
        outb(0x92, 0x3); // courtesy of Chris Frost
    }
    return c;
c0101ef5:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101ef8:	c9                   	leave  
c0101ef9:	c3                   	ret    

c0101efa <kbd_intr>:

/* kbd_intr - try to feed input characters from keyboard */
static void
kbd_intr(void) {
c0101efa:	f3 0f 1e fb          	endbr32 
c0101efe:	55                   	push   %ebp
c0101eff:	89 e5                	mov    %esp,%ebp
c0101f01:	83 ec 18             	sub    $0x18,%esp
    cons_intr(kbd_proc_data);
c0101f04:	c7 04 24 71 1d 10 c0 	movl   $0xc0101d71,(%esp)
c0101f0b:	e8 93 fd ff ff       	call   c0101ca3 <cons_intr>
}
c0101f10:	90                   	nop
c0101f11:	c9                   	leave  
c0101f12:	c3                   	ret    

c0101f13 <kbd_init>:

static void
kbd_init(void) {
c0101f13:	f3 0f 1e fb          	endbr32 
c0101f17:	55                   	push   %ebp
c0101f18:	89 e5                	mov    %esp,%ebp
c0101f1a:	83 ec 18             	sub    $0x18,%esp
    // drain the kbd buffer
    kbd_intr();
c0101f1d:	e8 d8 ff ff ff       	call   c0101efa <kbd_intr>
    pic_enable(IRQ_KBD);
c0101f22:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0101f29:	e8 47 01 00 00       	call   c0102075 <pic_enable>
}
c0101f2e:	90                   	nop
c0101f2f:	c9                   	leave  
c0101f30:	c3                   	ret    

c0101f31 <cons_init>:

/* cons_init - initializes the console devices */
void
cons_init(void) {
c0101f31:	f3 0f 1e fb          	endbr32 
c0101f35:	55                   	push   %ebp
c0101f36:	89 e5                	mov    %esp,%ebp
c0101f38:	83 ec 18             	sub    $0x18,%esp
    cga_init();
c0101f3b:	e8 2e f8 ff ff       	call   c010176e <cga_init>
    serial_init();
c0101f40:	e8 13 f9 ff ff       	call   c0101858 <serial_init>
    kbd_init();
c0101f45:	e8 c9 ff ff ff       	call   c0101f13 <kbd_init>
    if (!serial_exists) {
c0101f4a:	a1 28 b5 12 c0       	mov    0xc012b528,%eax
c0101f4f:	85 c0                	test   %eax,%eax
c0101f51:	75 0c                	jne    c0101f5f <cons_init+0x2e>
        cprintf("serial port does not exist!!\n");
c0101f53:	c7 04 24 ad a4 10 c0 	movl   $0xc010a4ad,(%esp)
c0101f5a:	e8 72 e3 ff ff       	call   c01002d1 <cprintf>
    }
}
c0101f5f:	90                   	nop
c0101f60:	c9                   	leave  
c0101f61:	c3                   	ret    

c0101f62 <cons_putc>:

/* cons_putc - print a single character @c to console devices */
void
cons_putc(int c) {
c0101f62:	f3 0f 1e fb          	endbr32 
c0101f66:	55                   	push   %ebp
c0101f67:	89 e5                	mov    %esp,%ebp
c0101f69:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c0101f6c:	e8 72 f7 ff ff       	call   c01016e3 <__intr_save>
c0101f71:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        lpt_putc(c);
c0101f74:	8b 45 08             	mov    0x8(%ebp),%eax
c0101f77:	89 04 24             	mov    %eax,(%esp)
c0101f7a:	e8 48 fa ff ff       	call   c01019c7 <lpt_putc>
        cga_putc(c);
c0101f7f:	8b 45 08             	mov    0x8(%ebp),%eax
c0101f82:	89 04 24             	mov    %eax,(%esp)
c0101f85:	e8 81 fa ff ff       	call   c0101a0b <cga_putc>
        serial_putc(c);
c0101f8a:	8b 45 08             	mov    0x8(%ebp),%eax
c0101f8d:	89 04 24             	mov    %eax,(%esp)
c0101f90:	e8 ca fc ff ff       	call   c0101c5f <serial_putc>
    }
    local_intr_restore(intr_flag);
c0101f95:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101f98:	89 04 24             	mov    %eax,(%esp)
c0101f9b:	e8 6d f7 ff ff       	call   c010170d <__intr_restore>
}
c0101fa0:	90                   	nop
c0101fa1:	c9                   	leave  
c0101fa2:	c3                   	ret    

c0101fa3 <cons_getc>:
/* *
 * cons_getc - return the next input character from console,
 * or 0 if none waiting.
 * */
int
cons_getc(void) {
c0101fa3:	f3 0f 1e fb          	endbr32 
c0101fa7:	55                   	push   %ebp
c0101fa8:	89 e5                	mov    %esp,%ebp
c0101faa:	83 ec 28             	sub    $0x28,%esp
    int c = 0;
c0101fad:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    local_intr_save(intr_flag);
c0101fb4:	e8 2a f7 ff ff       	call   c01016e3 <__intr_save>
c0101fb9:	89 45 f0             	mov    %eax,-0x10(%ebp)
    {
        // poll for any pending input characters,
        // so that this function works even when interrupts are disabled
        // (e.g., when called from the kernel monitor).
        serial_intr();
c0101fbc:	e8 8e fd ff ff       	call   c0101d4f <serial_intr>
        kbd_intr();
c0101fc1:	e8 34 ff ff ff       	call   c0101efa <kbd_intr>

        // grab the next character from the input buffer.
        if (cons.rpos != cons.wpos) {
c0101fc6:	8b 15 40 b7 12 c0    	mov    0xc012b740,%edx
c0101fcc:	a1 44 b7 12 c0       	mov    0xc012b744,%eax
c0101fd1:	39 c2                	cmp    %eax,%edx
c0101fd3:	74 31                	je     c0102006 <cons_getc+0x63>
            c = cons.buf[cons.rpos ++];
c0101fd5:	a1 40 b7 12 c0       	mov    0xc012b740,%eax
c0101fda:	8d 50 01             	lea    0x1(%eax),%edx
c0101fdd:	89 15 40 b7 12 c0    	mov    %edx,0xc012b740
c0101fe3:	0f b6 80 40 b5 12 c0 	movzbl -0x3fed4ac0(%eax),%eax
c0101fea:	0f b6 c0             	movzbl %al,%eax
c0101fed:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (cons.rpos == CONSBUFSIZE) {
c0101ff0:	a1 40 b7 12 c0       	mov    0xc012b740,%eax
c0101ff5:	3d 00 02 00 00       	cmp    $0x200,%eax
c0101ffa:	75 0a                	jne    c0102006 <cons_getc+0x63>
                cons.rpos = 0;
c0101ffc:	c7 05 40 b7 12 c0 00 	movl   $0x0,0xc012b740
c0102003:	00 00 00 
            }
        }
    }
    local_intr_restore(intr_flag);
c0102006:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102009:	89 04 24             	mov    %eax,(%esp)
c010200c:	e8 fc f6 ff ff       	call   c010170d <__intr_restore>
    return c;
c0102011:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0102014:	c9                   	leave  
c0102015:	c3                   	ret    

c0102016 <pic_setmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static uint16_t irq_mask = 0xFFFF & ~(1 << IRQ_SLAVE);
static bool did_init = 0;

static void
pic_setmask(uint16_t mask) {
c0102016:	f3 0f 1e fb          	endbr32 
c010201a:	55                   	push   %ebp
c010201b:	89 e5                	mov    %esp,%ebp
c010201d:	83 ec 14             	sub    $0x14,%esp
c0102020:	8b 45 08             	mov    0x8(%ebp),%eax
c0102023:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    irq_mask = mask;
c0102027:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010202a:	66 a3 50 85 12 c0    	mov    %ax,0xc0128550
    if (did_init) {
c0102030:	a1 4c b7 12 c0       	mov    0xc012b74c,%eax
c0102035:	85 c0                	test   %eax,%eax
c0102037:	74 39                	je     c0102072 <pic_setmask+0x5c>
        outb(IO_PIC1 + 1, mask);
c0102039:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010203c:	0f b6 c0             	movzbl %al,%eax
c010203f:	66 c7 45 fa 21 00    	movw   $0x21,-0x6(%ebp)
c0102045:	88 45 f9             	mov    %al,-0x7(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102048:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c010204c:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0102050:	ee                   	out    %al,(%dx)
}
c0102051:	90                   	nop
        outb(IO_PIC2 + 1, mask >> 8);
c0102052:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0102056:	c1 e8 08             	shr    $0x8,%eax
c0102059:	0f b7 c0             	movzwl %ax,%eax
c010205c:	0f b6 c0             	movzbl %al,%eax
c010205f:	66 c7 45 fe a1 00    	movw   $0xa1,-0x2(%ebp)
c0102065:	88 45 fd             	mov    %al,-0x3(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102068:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c010206c:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0102070:	ee                   	out    %al,(%dx)
}
c0102071:	90                   	nop
    }
}
c0102072:	90                   	nop
c0102073:	c9                   	leave  
c0102074:	c3                   	ret    

c0102075 <pic_enable>:

void
pic_enable(unsigned int irq) {
c0102075:	f3 0f 1e fb          	endbr32 
c0102079:	55                   	push   %ebp
c010207a:	89 e5                	mov    %esp,%ebp
c010207c:	83 ec 04             	sub    $0x4,%esp
    pic_setmask(irq_mask & ~(1 << irq));
c010207f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102082:	ba 01 00 00 00       	mov    $0x1,%edx
c0102087:	88 c1                	mov    %al,%cl
c0102089:	d3 e2                	shl    %cl,%edx
c010208b:	89 d0                	mov    %edx,%eax
c010208d:	98                   	cwtl   
c010208e:	f7 d0                	not    %eax
c0102090:	0f bf d0             	movswl %ax,%edx
c0102093:	0f b7 05 50 85 12 c0 	movzwl 0xc0128550,%eax
c010209a:	98                   	cwtl   
c010209b:	21 d0                	and    %edx,%eax
c010209d:	98                   	cwtl   
c010209e:	0f b7 c0             	movzwl %ax,%eax
c01020a1:	89 04 24             	mov    %eax,(%esp)
c01020a4:	e8 6d ff ff ff       	call   c0102016 <pic_setmask>
}
c01020a9:	90                   	nop
c01020aa:	c9                   	leave  
c01020ab:	c3                   	ret    

c01020ac <pic_init>:

/* pic_init - initialize the 8259A interrupt controllers */
void
pic_init(void) {
c01020ac:	f3 0f 1e fb          	endbr32 
c01020b0:	55                   	push   %ebp
c01020b1:	89 e5                	mov    %esp,%ebp
c01020b3:	83 ec 44             	sub    $0x44,%esp
    did_init = 1;
c01020b6:	c7 05 4c b7 12 c0 01 	movl   $0x1,0xc012b74c
c01020bd:	00 00 00 
c01020c0:	66 c7 45 ca 21 00    	movw   $0x21,-0x36(%ebp)
c01020c6:	c6 45 c9 ff          	movb   $0xff,-0x37(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01020ca:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c01020ce:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c01020d2:	ee                   	out    %al,(%dx)
}
c01020d3:	90                   	nop
c01020d4:	66 c7 45 ce a1 00    	movw   $0xa1,-0x32(%ebp)
c01020da:	c6 45 cd ff          	movb   $0xff,-0x33(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01020de:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c01020e2:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c01020e6:	ee                   	out    %al,(%dx)
}
c01020e7:	90                   	nop
c01020e8:	66 c7 45 d2 20 00    	movw   $0x20,-0x2e(%ebp)
c01020ee:	c6 45 d1 11          	movb   $0x11,-0x2f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01020f2:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c01020f6:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c01020fa:	ee                   	out    %al,(%dx)
}
c01020fb:	90                   	nop
c01020fc:	66 c7 45 d6 21 00    	movw   $0x21,-0x2a(%ebp)
c0102102:	c6 45 d5 20          	movb   $0x20,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102106:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c010210a:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c010210e:	ee                   	out    %al,(%dx)
}
c010210f:	90                   	nop
c0102110:	66 c7 45 da 21 00    	movw   $0x21,-0x26(%ebp)
c0102116:	c6 45 d9 04          	movb   $0x4,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010211a:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c010211e:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0102122:	ee                   	out    %al,(%dx)
}
c0102123:	90                   	nop
c0102124:	66 c7 45 de 21 00    	movw   $0x21,-0x22(%ebp)
c010212a:	c6 45 dd 03          	movb   $0x3,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010212e:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0102132:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0102136:	ee                   	out    %al,(%dx)
}
c0102137:	90                   	nop
c0102138:	66 c7 45 e2 a0 00    	movw   $0xa0,-0x1e(%ebp)
c010213e:	c6 45 e1 11          	movb   $0x11,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102142:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0102146:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c010214a:	ee                   	out    %al,(%dx)
}
c010214b:	90                   	nop
c010214c:	66 c7 45 e6 a1 00    	movw   $0xa1,-0x1a(%ebp)
c0102152:	c6 45 e5 28          	movb   $0x28,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102156:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c010215a:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c010215e:	ee                   	out    %al,(%dx)
}
c010215f:	90                   	nop
c0102160:	66 c7 45 ea a1 00    	movw   $0xa1,-0x16(%ebp)
c0102166:	c6 45 e9 02          	movb   $0x2,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010216a:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c010216e:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0102172:	ee                   	out    %al,(%dx)
}
c0102173:	90                   	nop
c0102174:	66 c7 45 ee a1 00    	movw   $0xa1,-0x12(%ebp)
c010217a:	c6 45 ed 03          	movb   $0x3,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010217e:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0102182:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0102186:	ee                   	out    %al,(%dx)
}
c0102187:	90                   	nop
c0102188:	66 c7 45 f2 20 00    	movw   $0x20,-0xe(%ebp)
c010218e:	c6 45 f1 68          	movb   $0x68,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102192:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0102196:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010219a:	ee                   	out    %al,(%dx)
}
c010219b:	90                   	nop
c010219c:	66 c7 45 f6 20 00    	movw   $0x20,-0xa(%ebp)
c01021a2:	c6 45 f5 0a          	movb   $0xa,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01021a6:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c01021aa:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01021ae:	ee                   	out    %al,(%dx)
}
c01021af:	90                   	nop
c01021b0:	66 c7 45 fa a0 00    	movw   $0xa0,-0x6(%ebp)
c01021b6:	c6 45 f9 68          	movb   $0x68,-0x7(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01021ba:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c01021be:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c01021c2:	ee                   	out    %al,(%dx)
}
c01021c3:	90                   	nop
c01021c4:	66 c7 45 fe a0 00    	movw   $0xa0,-0x2(%ebp)
c01021ca:	c6 45 fd 0a          	movb   $0xa,-0x3(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01021ce:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c01021d2:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c01021d6:	ee                   	out    %al,(%dx)
}
c01021d7:	90                   	nop
    outb(IO_PIC1, 0x0a);    // read IRR by default

    outb(IO_PIC2, 0x68);    // OCW3
    outb(IO_PIC2, 0x0a);    // OCW3

    if (irq_mask != 0xFFFF) {
c01021d8:	0f b7 05 50 85 12 c0 	movzwl 0xc0128550,%eax
c01021df:	3d ff ff 00 00       	cmp    $0xffff,%eax
c01021e4:	74 0f                	je     c01021f5 <pic_init+0x149>
        pic_setmask(irq_mask);
c01021e6:	0f b7 05 50 85 12 c0 	movzwl 0xc0128550,%eax
c01021ed:	89 04 24             	mov    %eax,(%esp)
c01021f0:	e8 21 fe ff ff       	call   c0102016 <pic_setmask>
    }
}
c01021f5:	90                   	nop
c01021f6:	c9                   	leave  
c01021f7:	c3                   	ret    

c01021f8 <intr_enable>:
#include <x86.h>
#include <intr.h>

/* intr_enable - enable irq interrupt */
void
intr_enable(void) {
c01021f8:	f3 0f 1e fb          	endbr32 
c01021fc:	55                   	push   %ebp
c01021fd:	89 e5                	mov    %esp,%ebp
    asm volatile ("sti");
c01021ff:	fb                   	sti    
}
c0102200:	90                   	nop
    sti();
}
c0102201:	90                   	nop
c0102202:	5d                   	pop    %ebp
c0102203:	c3                   	ret    

c0102204 <intr_disable>:

/* intr_disable - disable irq interrupt */
void
intr_disable(void) {
c0102204:	f3 0f 1e fb          	endbr32 
c0102208:	55                   	push   %ebp
c0102209:	89 e5                	mov    %esp,%ebp
    asm volatile ("cli" ::: "memory");
c010220b:	fa                   	cli    
}
c010220c:	90                   	nop
    cli();
}
c010220d:	90                   	nop
c010220e:	5d                   	pop    %ebp
c010220f:	c3                   	ret    

c0102210 <print_ticks>:
#include <swap.h>
#include <kdebug.h>

#define TICK_NUM 100

static void print_ticks() {
c0102210:	f3 0f 1e fb          	endbr32 
c0102214:	55                   	push   %ebp
c0102215:	89 e5                	mov    %esp,%ebp
c0102217:	83 ec 18             	sub    $0x18,%esp
    cprintf("%d ticks\n",TICK_NUM);
c010221a:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c0102221:	00 
c0102222:	c7 04 24 e0 a4 10 c0 	movl   $0xc010a4e0,(%esp)
c0102229:	e8 a3 e0 ff ff       	call   c01002d1 <cprintf>
#ifdef DEBUG_GRADE
    cprintf("End of Test.\n");
c010222e:	c7 04 24 ea a4 10 c0 	movl   $0xc010a4ea,(%esp)
c0102235:	e8 97 e0 ff ff       	call   c01002d1 <cprintf>
    panic("EOT: kernel seems ok.");
c010223a:	c7 44 24 08 f8 a4 10 	movl   $0xc010a4f8,0x8(%esp)
c0102241:	c0 
c0102242:	c7 44 24 04 14 00 00 	movl   $0x14,0x4(%esp)
c0102249:	00 
c010224a:	c7 04 24 0e a5 10 c0 	movl   $0xc010a50e,(%esp)
c0102251:	e8 e7 e1 ff ff       	call   c010043d <__panic>

c0102256 <idt_init>:
    sizeof(idt) - 1, (uintptr_t)idt
};

/* idt_init - initialize IDT to each of the entry points in kern/trap/vectors.S */
void
idt_init(void) {
c0102256:	f3 0f 1e fb          	endbr32 
c010225a:	55                   	push   %ebp
c010225b:	89 e5                	mov    %esp,%ebp
c010225d:	83 ec 10             	sub    $0x10,%esp
      *     You don't know the meaning of this instruction? just google it! and check the libs/x86.h to know more.
      *     Notice: the argument of lidt is idt_pd. try to find it!
      */
	extern uintptr_t __vectors[];
	int u;
	for(u=0;u<sizeof(idt)/sizeof(struct gatedesc);u++)
c0102260:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c0102267:	e9 c4 00 00 00       	jmp    c0102330 <idt_init+0xda>
		SETGATE(idt[u],0,GD_KTEXT,__vectors[u],DPL_KERNEL);
c010226c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010226f:	8b 04 85 e0 85 12 c0 	mov    -0x3fed7a20(,%eax,4),%eax
c0102276:	0f b7 d0             	movzwl %ax,%edx
c0102279:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010227c:	66 89 14 c5 60 b7 12 	mov    %dx,-0x3fed48a0(,%eax,8)
c0102283:	c0 
c0102284:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102287:	66 c7 04 c5 62 b7 12 	movw   $0x8,-0x3fed489e(,%eax,8)
c010228e:	c0 08 00 
c0102291:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102294:	0f b6 14 c5 64 b7 12 	movzbl -0x3fed489c(,%eax,8),%edx
c010229b:	c0 
c010229c:	80 e2 e0             	and    $0xe0,%dl
c010229f:	88 14 c5 64 b7 12 c0 	mov    %dl,-0x3fed489c(,%eax,8)
c01022a6:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01022a9:	0f b6 14 c5 64 b7 12 	movzbl -0x3fed489c(,%eax,8),%edx
c01022b0:	c0 
c01022b1:	80 e2 1f             	and    $0x1f,%dl
c01022b4:	88 14 c5 64 b7 12 c0 	mov    %dl,-0x3fed489c(,%eax,8)
c01022bb:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01022be:	0f b6 14 c5 65 b7 12 	movzbl -0x3fed489b(,%eax,8),%edx
c01022c5:	c0 
c01022c6:	80 e2 f0             	and    $0xf0,%dl
c01022c9:	80 ca 0e             	or     $0xe,%dl
c01022cc:	88 14 c5 65 b7 12 c0 	mov    %dl,-0x3fed489b(,%eax,8)
c01022d3:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01022d6:	0f b6 14 c5 65 b7 12 	movzbl -0x3fed489b(,%eax,8),%edx
c01022dd:	c0 
c01022de:	80 e2 ef             	and    $0xef,%dl
c01022e1:	88 14 c5 65 b7 12 c0 	mov    %dl,-0x3fed489b(,%eax,8)
c01022e8:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01022eb:	0f b6 14 c5 65 b7 12 	movzbl -0x3fed489b(,%eax,8),%edx
c01022f2:	c0 
c01022f3:	80 e2 9f             	and    $0x9f,%dl
c01022f6:	88 14 c5 65 b7 12 c0 	mov    %dl,-0x3fed489b(,%eax,8)
c01022fd:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102300:	0f b6 14 c5 65 b7 12 	movzbl -0x3fed489b(,%eax,8),%edx
c0102307:	c0 
c0102308:	80 ca 80             	or     $0x80,%dl
c010230b:	88 14 c5 65 b7 12 c0 	mov    %dl,-0x3fed489b(,%eax,8)
c0102312:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102315:	8b 04 85 e0 85 12 c0 	mov    -0x3fed7a20(,%eax,4),%eax
c010231c:	c1 e8 10             	shr    $0x10,%eax
c010231f:	0f b7 d0             	movzwl %ax,%edx
c0102322:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102325:	66 89 14 c5 66 b7 12 	mov    %dx,-0x3fed489a(,%eax,8)
c010232c:	c0 
	for(u=0;u<sizeof(idt)/sizeof(struct gatedesc);u++)
c010232d:	ff 45 fc             	incl   -0x4(%ebp)
c0102330:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102333:	3d ff 00 00 00       	cmp    $0xff,%eax
c0102338:	0f 86 2e ff ff ff    	jbe    c010226c <idt_init+0x16>
c010233e:	c7 45 f8 60 85 12 c0 	movl   $0xc0128560,-0x8(%ebp)
    asm volatile ("lidt (%0)" :: "r" (pd) : "memory");
c0102345:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0102348:	0f 01 18             	lidtl  (%eax)
}
c010234b:	90                   	nop
	lidt(&idt_pd);
}
c010234c:	90                   	nop
c010234d:	c9                   	leave  
c010234e:	c3                   	ret    

c010234f <trapname>:

static const char *
trapname(int trapno) {
c010234f:	f3 0f 1e fb          	endbr32 
c0102353:	55                   	push   %ebp
c0102354:	89 e5                	mov    %esp,%ebp
        "Alignment Check",
        "Machine-Check",
        "SIMD Floating-Point Exception"
    };

    if (trapno < sizeof(excnames)/sizeof(const char * const)) {
c0102356:	8b 45 08             	mov    0x8(%ebp),%eax
c0102359:	83 f8 13             	cmp    $0x13,%eax
c010235c:	77 0c                	ja     c010236a <trapname+0x1b>
        return excnames[trapno];
c010235e:	8b 45 08             	mov    0x8(%ebp),%eax
c0102361:	8b 04 85 60 a9 10 c0 	mov    -0x3fef56a0(,%eax,4),%eax
c0102368:	eb 18                	jmp    c0102382 <trapname+0x33>
    }
    if (trapno >= IRQ_OFFSET && trapno < IRQ_OFFSET + 16) {
c010236a:	83 7d 08 1f          	cmpl   $0x1f,0x8(%ebp)
c010236e:	7e 0d                	jle    c010237d <trapname+0x2e>
c0102370:	83 7d 08 2f          	cmpl   $0x2f,0x8(%ebp)
c0102374:	7f 07                	jg     c010237d <trapname+0x2e>
        return "Hardware Interrupt";
c0102376:	b8 1f a5 10 c0       	mov    $0xc010a51f,%eax
c010237b:	eb 05                	jmp    c0102382 <trapname+0x33>
    }
    return "(unknown trap)";
c010237d:	b8 32 a5 10 c0       	mov    $0xc010a532,%eax
}
c0102382:	5d                   	pop    %ebp
c0102383:	c3                   	ret    

c0102384 <trap_in_kernel>:

/* trap_in_kernel - test if trap happened in kernel */
bool
trap_in_kernel(struct trapframe *tf) {
c0102384:	f3 0f 1e fb          	endbr32 
c0102388:	55                   	push   %ebp
c0102389:	89 e5                	mov    %esp,%ebp
    return (tf->tf_cs == (uint16_t)KERNEL_CS);
c010238b:	8b 45 08             	mov    0x8(%ebp),%eax
c010238e:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c0102392:	83 f8 08             	cmp    $0x8,%eax
c0102395:	0f 94 c0             	sete   %al
c0102398:	0f b6 c0             	movzbl %al,%eax
}
c010239b:	5d                   	pop    %ebp
c010239c:	c3                   	ret    

c010239d <print_trapframe>:
    "TF", "IF", "DF", "OF", NULL, NULL, "NT", NULL,
    "RF", "VM", "AC", "VIF", "VIP", "ID", NULL, NULL,
};

void
print_trapframe(struct trapframe *tf) {
c010239d:	f3 0f 1e fb          	endbr32 
c01023a1:	55                   	push   %ebp
c01023a2:	89 e5                	mov    %esp,%ebp
c01023a4:	83 ec 28             	sub    $0x28,%esp
    cprintf("trapframe at %p\n", tf);
c01023a7:	8b 45 08             	mov    0x8(%ebp),%eax
c01023aa:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023ae:	c7 04 24 73 a5 10 c0 	movl   $0xc010a573,(%esp)
c01023b5:	e8 17 df ff ff       	call   c01002d1 <cprintf>
    print_regs(&tf->tf_regs);
c01023ba:	8b 45 08             	mov    0x8(%ebp),%eax
c01023bd:	89 04 24             	mov    %eax,(%esp)
c01023c0:	e8 8d 01 00 00       	call   c0102552 <print_regs>
    cprintf("  ds   0x----%04x\n", tf->tf_ds);
c01023c5:	8b 45 08             	mov    0x8(%ebp),%eax
c01023c8:	0f b7 40 2c          	movzwl 0x2c(%eax),%eax
c01023cc:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023d0:	c7 04 24 84 a5 10 c0 	movl   $0xc010a584,(%esp)
c01023d7:	e8 f5 de ff ff       	call   c01002d1 <cprintf>
    cprintf("  es   0x----%04x\n", tf->tf_es);
c01023dc:	8b 45 08             	mov    0x8(%ebp),%eax
c01023df:	0f b7 40 28          	movzwl 0x28(%eax),%eax
c01023e3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023e7:	c7 04 24 97 a5 10 c0 	movl   $0xc010a597,(%esp)
c01023ee:	e8 de de ff ff       	call   c01002d1 <cprintf>
    cprintf("  fs   0x----%04x\n", tf->tf_fs);
c01023f3:	8b 45 08             	mov    0x8(%ebp),%eax
c01023f6:	0f b7 40 24          	movzwl 0x24(%eax),%eax
c01023fa:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023fe:	c7 04 24 aa a5 10 c0 	movl   $0xc010a5aa,(%esp)
c0102405:	e8 c7 de ff ff       	call   c01002d1 <cprintf>
    cprintf("  gs   0x----%04x\n", tf->tf_gs);
c010240a:	8b 45 08             	mov    0x8(%ebp),%eax
c010240d:	0f b7 40 20          	movzwl 0x20(%eax),%eax
c0102411:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102415:	c7 04 24 bd a5 10 c0 	movl   $0xc010a5bd,(%esp)
c010241c:	e8 b0 de ff ff       	call   c01002d1 <cprintf>
    cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
c0102421:	8b 45 08             	mov    0x8(%ebp),%eax
c0102424:	8b 40 30             	mov    0x30(%eax),%eax
c0102427:	89 04 24             	mov    %eax,(%esp)
c010242a:	e8 20 ff ff ff       	call   c010234f <trapname>
c010242f:	8b 55 08             	mov    0x8(%ebp),%edx
c0102432:	8b 52 30             	mov    0x30(%edx),%edx
c0102435:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102439:	89 54 24 04          	mov    %edx,0x4(%esp)
c010243d:	c7 04 24 d0 a5 10 c0 	movl   $0xc010a5d0,(%esp)
c0102444:	e8 88 de ff ff       	call   c01002d1 <cprintf>
    cprintf("  err  0x%08x\n", tf->tf_err);
c0102449:	8b 45 08             	mov    0x8(%ebp),%eax
c010244c:	8b 40 34             	mov    0x34(%eax),%eax
c010244f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102453:	c7 04 24 e2 a5 10 c0 	movl   $0xc010a5e2,(%esp)
c010245a:	e8 72 de ff ff       	call   c01002d1 <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
c010245f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102462:	8b 40 38             	mov    0x38(%eax),%eax
c0102465:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102469:	c7 04 24 f1 a5 10 c0 	movl   $0xc010a5f1,(%esp)
c0102470:	e8 5c de ff ff       	call   c01002d1 <cprintf>
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
c0102475:	8b 45 08             	mov    0x8(%ebp),%eax
c0102478:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c010247c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102480:	c7 04 24 00 a6 10 c0 	movl   $0xc010a600,(%esp)
c0102487:	e8 45 de ff ff       	call   c01002d1 <cprintf>
    cprintf("  flag 0x%08x ", tf->tf_eflags);
c010248c:	8b 45 08             	mov    0x8(%ebp),%eax
c010248f:	8b 40 40             	mov    0x40(%eax),%eax
c0102492:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102496:	c7 04 24 13 a6 10 c0 	movl   $0xc010a613,(%esp)
c010249d:	e8 2f de ff ff       	call   c01002d1 <cprintf>

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c01024a2:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01024a9:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
c01024b0:	eb 3d                	jmp    c01024ef <print_trapframe+0x152>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
c01024b2:	8b 45 08             	mov    0x8(%ebp),%eax
c01024b5:	8b 50 40             	mov    0x40(%eax),%edx
c01024b8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01024bb:	21 d0                	and    %edx,%eax
c01024bd:	85 c0                	test   %eax,%eax
c01024bf:	74 28                	je     c01024e9 <print_trapframe+0x14c>
c01024c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01024c4:	8b 04 85 80 85 12 c0 	mov    -0x3fed7a80(,%eax,4),%eax
c01024cb:	85 c0                	test   %eax,%eax
c01024cd:	74 1a                	je     c01024e9 <print_trapframe+0x14c>
            cprintf("%s,", IA32flags[i]);
c01024cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01024d2:	8b 04 85 80 85 12 c0 	mov    -0x3fed7a80(,%eax,4),%eax
c01024d9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024dd:	c7 04 24 22 a6 10 c0 	movl   $0xc010a622,(%esp)
c01024e4:	e8 e8 dd ff ff       	call   c01002d1 <cprintf>
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c01024e9:	ff 45 f4             	incl   -0xc(%ebp)
c01024ec:	d1 65 f0             	shll   -0x10(%ebp)
c01024ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01024f2:	83 f8 17             	cmp    $0x17,%eax
c01024f5:	76 bb                	jbe    c01024b2 <print_trapframe+0x115>
        }
    }
    cprintf("IOPL=%d\n", (tf->tf_eflags & FL_IOPL_MASK) >> 12);
c01024f7:	8b 45 08             	mov    0x8(%ebp),%eax
c01024fa:	8b 40 40             	mov    0x40(%eax),%eax
c01024fd:	c1 e8 0c             	shr    $0xc,%eax
c0102500:	83 e0 03             	and    $0x3,%eax
c0102503:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102507:	c7 04 24 26 a6 10 c0 	movl   $0xc010a626,(%esp)
c010250e:	e8 be dd ff ff       	call   c01002d1 <cprintf>

    if (!trap_in_kernel(tf)) {
c0102513:	8b 45 08             	mov    0x8(%ebp),%eax
c0102516:	89 04 24             	mov    %eax,(%esp)
c0102519:	e8 66 fe ff ff       	call   c0102384 <trap_in_kernel>
c010251e:	85 c0                	test   %eax,%eax
c0102520:	75 2d                	jne    c010254f <print_trapframe+0x1b2>
        cprintf("  esp  0x%08x\n", tf->tf_esp);
c0102522:	8b 45 08             	mov    0x8(%ebp),%eax
c0102525:	8b 40 44             	mov    0x44(%eax),%eax
c0102528:	89 44 24 04          	mov    %eax,0x4(%esp)
c010252c:	c7 04 24 2f a6 10 c0 	movl   $0xc010a62f,(%esp)
c0102533:	e8 99 dd ff ff       	call   c01002d1 <cprintf>
        cprintf("  ss   0x----%04x\n", tf->tf_ss);
c0102538:	8b 45 08             	mov    0x8(%ebp),%eax
c010253b:	0f b7 40 48          	movzwl 0x48(%eax),%eax
c010253f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102543:	c7 04 24 3e a6 10 c0 	movl   $0xc010a63e,(%esp)
c010254a:	e8 82 dd ff ff       	call   c01002d1 <cprintf>
    }
}
c010254f:	90                   	nop
c0102550:	c9                   	leave  
c0102551:	c3                   	ret    

c0102552 <print_regs>:

void
print_regs(struct pushregs *regs) {
c0102552:	f3 0f 1e fb          	endbr32 
c0102556:	55                   	push   %ebp
c0102557:	89 e5                	mov    %esp,%ebp
c0102559:	83 ec 18             	sub    $0x18,%esp
    cprintf("  edi  0x%08x\n", regs->reg_edi);
c010255c:	8b 45 08             	mov    0x8(%ebp),%eax
c010255f:	8b 00                	mov    (%eax),%eax
c0102561:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102565:	c7 04 24 51 a6 10 c0 	movl   $0xc010a651,(%esp)
c010256c:	e8 60 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  esi  0x%08x\n", regs->reg_esi);
c0102571:	8b 45 08             	mov    0x8(%ebp),%eax
c0102574:	8b 40 04             	mov    0x4(%eax),%eax
c0102577:	89 44 24 04          	mov    %eax,0x4(%esp)
c010257b:	c7 04 24 60 a6 10 c0 	movl   $0xc010a660,(%esp)
c0102582:	e8 4a dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  ebp  0x%08x\n", regs->reg_ebp);
c0102587:	8b 45 08             	mov    0x8(%ebp),%eax
c010258a:	8b 40 08             	mov    0x8(%eax),%eax
c010258d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102591:	c7 04 24 6f a6 10 c0 	movl   $0xc010a66f,(%esp)
c0102598:	e8 34 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  oesp 0x%08x\n", regs->reg_oesp);
c010259d:	8b 45 08             	mov    0x8(%ebp),%eax
c01025a0:	8b 40 0c             	mov    0xc(%eax),%eax
c01025a3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025a7:	c7 04 24 7e a6 10 c0 	movl   $0xc010a67e,(%esp)
c01025ae:	e8 1e dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  ebx  0x%08x\n", regs->reg_ebx);
c01025b3:	8b 45 08             	mov    0x8(%ebp),%eax
c01025b6:	8b 40 10             	mov    0x10(%eax),%eax
c01025b9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025bd:	c7 04 24 8d a6 10 c0 	movl   $0xc010a68d,(%esp)
c01025c4:	e8 08 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  edx  0x%08x\n", regs->reg_edx);
c01025c9:	8b 45 08             	mov    0x8(%ebp),%eax
c01025cc:	8b 40 14             	mov    0x14(%eax),%eax
c01025cf:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025d3:	c7 04 24 9c a6 10 c0 	movl   $0xc010a69c,(%esp)
c01025da:	e8 f2 dc ff ff       	call   c01002d1 <cprintf>
    cprintf("  ecx  0x%08x\n", regs->reg_ecx);
c01025df:	8b 45 08             	mov    0x8(%ebp),%eax
c01025e2:	8b 40 18             	mov    0x18(%eax),%eax
c01025e5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025e9:	c7 04 24 ab a6 10 c0 	movl   $0xc010a6ab,(%esp)
c01025f0:	e8 dc dc ff ff       	call   c01002d1 <cprintf>
    cprintf("  eax  0x%08x\n", regs->reg_eax);
c01025f5:	8b 45 08             	mov    0x8(%ebp),%eax
c01025f8:	8b 40 1c             	mov    0x1c(%eax),%eax
c01025fb:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025ff:	c7 04 24 ba a6 10 c0 	movl   $0xc010a6ba,(%esp)
c0102606:	e8 c6 dc ff ff       	call   c01002d1 <cprintf>
}
c010260b:	90                   	nop
c010260c:	c9                   	leave  
c010260d:	c3                   	ret    

c010260e <print_pgfault>:

static inline void
print_pgfault(struct trapframe *tf) {
c010260e:	55                   	push   %ebp
c010260f:	89 e5                	mov    %esp,%ebp
c0102611:	53                   	push   %ebx
c0102612:	83 ec 34             	sub    $0x34,%esp
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
c0102615:	8b 45 08             	mov    0x8(%ebp),%eax
c0102618:	8b 40 34             	mov    0x34(%eax),%eax
c010261b:	83 e0 01             	and    $0x1,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c010261e:	85 c0                	test   %eax,%eax
c0102620:	74 07                	je     c0102629 <print_pgfault+0x1b>
c0102622:	bb c9 a6 10 c0       	mov    $0xc010a6c9,%ebx
c0102627:	eb 05                	jmp    c010262e <print_pgfault+0x20>
c0102629:	bb da a6 10 c0       	mov    $0xc010a6da,%ebx
            (tf->tf_err & 2) ? 'W' : 'R',
c010262e:	8b 45 08             	mov    0x8(%ebp),%eax
c0102631:	8b 40 34             	mov    0x34(%eax),%eax
c0102634:	83 e0 02             	and    $0x2,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0102637:	85 c0                	test   %eax,%eax
c0102639:	74 07                	je     c0102642 <print_pgfault+0x34>
c010263b:	b9 57 00 00 00       	mov    $0x57,%ecx
c0102640:	eb 05                	jmp    c0102647 <print_pgfault+0x39>
c0102642:	b9 52 00 00 00       	mov    $0x52,%ecx
            (tf->tf_err & 4) ? 'U' : 'K',
c0102647:	8b 45 08             	mov    0x8(%ebp),%eax
c010264a:	8b 40 34             	mov    0x34(%eax),%eax
c010264d:	83 e0 04             	and    $0x4,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0102650:	85 c0                	test   %eax,%eax
c0102652:	74 07                	je     c010265b <print_pgfault+0x4d>
c0102654:	ba 55 00 00 00       	mov    $0x55,%edx
c0102659:	eb 05                	jmp    c0102660 <print_pgfault+0x52>
c010265b:	ba 4b 00 00 00       	mov    $0x4b,%edx
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c0102660:	0f 20 d0             	mov    %cr2,%eax
c0102663:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr2;
c0102666:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102669:	89 5c 24 10          	mov    %ebx,0x10(%esp)
c010266d:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0102671:	89 54 24 08          	mov    %edx,0x8(%esp)
c0102675:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102679:	c7 04 24 e8 a6 10 c0 	movl   $0xc010a6e8,(%esp)
c0102680:	e8 4c dc ff ff       	call   c01002d1 <cprintf>
}
c0102685:	90                   	nop
c0102686:	83 c4 34             	add    $0x34,%esp
c0102689:	5b                   	pop    %ebx
c010268a:	5d                   	pop    %ebp
c010268b:	c3                   	ret    

c010268c <pgfault_handler>:

static int
pgfault_handler(struct trapframe *tf) {
c010268c:	f3 0f 1e fb          	endbr32 
c0102690:	55                   	push   %ebp
c0102691:	89 e5                	mov    %esp,%ebp
c0102693:	83 ec 28             	sub    $0x28,%esp
    extern struct mm_struct *check_mm_struct;
    print_pgfault(tf);
c0102696:	8b 45 08             	mov    0x8(%ebp),%eax
c0102699:	89 04 24             	mov    %eax,(%esp)
c010269c:	e8 6d ff ff ff       	call   c010260e <print_pgfault>
    if (check_mm_struct != NULL) {
c01026a1:	a1 6c e0 12 c0       	mov    0xc012e06c,%eax
c01026a6:	85 c0                	test   %eax,%eax
c01026a8:	74 26                	je     c01026d0 <pgfault_handler+0x44>
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c01026aa:	0f 20 d0             	mov    %cr2,%eax
c01026ad:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr2;
c01026b0:	8b 4d f4             	mov    -0xc(%ebp),%ecx
        return do_pgfault(check_mm_struct, tf->tf_err, rcr2());
c01026b3:	8b 45 08             	mov    0x8(%ebp),%eax
c01026b6:	8b 50 34             	mov    0x34(%eax),%edx
c01026b9:	a1 6c e0 12 c0       	mov    0xc012e06c,%eax
c01026be:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01026c2:	89 54 24 04          	mov    %edx,0x4(%esp)
c01026c6:	89 04 24             	mov    %eax,(%esp)
c01026c9:	e8 7b 37 00 00       	call   c0105e49 <do_pgfault>
c01026ce:	eb 1c                	jmp    c01026ec <pgfault_handler+0x60>
    }
    panic("unhandled page fault.\n");
c01026d0:	c7 44 24 08 0b a7 10 	movl   $0xc010a70b,0x8(%esp)
c01026d7:	c0 
c01026d8:	c7 44 24 04 a4 00 00 	movl   $0xa4,0x4(%esp)
c01026df:	00 
c01026e0:	c7 04 24 0e a5 10 c0 	movl   $0xc010a50e,(%esp)
c01026e7:	e8 51 dd ff ff       	call   c010043d <__panic>
}
c01026ec:	c9                   	leave  
c01026ed:	c3                   	ret    

c01026ee <trap_dispatch>:

static volatile int in_swap_tick_event = 0;
extern struct mm_struct *check_mm_struct;

static void
trap_dispatch(struct trapframe *tf) {
c01026ee:	f3 0f 1e fb          	endbr32 
c01026f2:	55                   	push   %ebp
c01026f3:	89 e5                	mov    %esp,%ebp
c01026f5:	83 ec 28             	sub    $0x28,%esp
    char c;

    int ret;

    switch (tf->tf_trapno) {
c01026f8:	8b 45 08             	mov    0x8(%ebp),%eax
c01026fb:	8b 40 30             	mov    0x30(%eax),%eax
c01026fe:	83 f8 2f             	cmp    $0x2f,%eax
c0102701:	77 1f                	ja     c0102722 <trap_dispatch+0x34>
c0102703:	83 f8 0e             	cmp    $0xe,%eax
c0102706:	0f 82 1b 01 00 00    	jb     c0102827 <trap_dispatch+0x139>
c010270c:	83 e8 0e             	sub    $0xe,%eax
c010270f:	83 f8 21             	cmp    $0x21,%eax
c0102712:	0f 87 0f 01 00 00    	ja     c0102827 <trap_dispatch+0x139>
c0102718:	8b 04 85 8c a7 10 c0 	mov    -0x3fef5874(,%eax,4),%eax
c010271f:	3e ff e0             	notrack jmp *%eax
c0102722:	83 e8 78             	sub    $0x78,%eax
c0102725:	83 f8 01             	cmp    $0x1,%eax
c0102728:	0f 87 f9 00 00 00    	ja     c0102827 <trap_dispatch+0x139>
c010272e:	e9 d8 00 00 00       	jmp    c010280b <trap_dispatch+0x11d>
    case T_PGFLT:  //page fault
        if ((ret = pgfault_handler(tf)) != 0) {
c0102733:	8b 45 08             	mov    0x8(%ebp),%eax
c0102736:	89 04 24             	mov    %eax,(%esp)
c0102739:	e8 4e ff ff ff       	call   c010268c <pgfault_handler>
c010273e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0102741:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0102745:	0f 84 14 01 00 00    	je     c010285f <trap_dispatch+0x171>
            print_trapframe(tf);
c010274b:	8b 45 08             	mov    0x8(%ebp),%eax
c010274e:	89 04 24             	mov    %eax,(%esp)
c0102751:	e8 47 fc ff ff       	call   c010239d <print_trapframe>
            panic("handle pgfault failed. %e\n", ret);
c0102756:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102759:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010275d:	c7 44 24 08 22 a7 10 	movl   $0xc010a722,0x8(%esp)
c0102764:	c0 
c0102765:	c7 44 24 04 b4 00 00 	movl   $0xb4,0x4(%esp)
c010276c:	00 
c010276d:	c7 04 24 0e a5 10 c0 	movl   $0xc010a50e,(%esp)
c0102774:	e8 c4 dc ff ff       	call   c010043d <__panic>
        /* handle the timer interrupt */
        /* (1) After a timer interrupt, you should record this event using a global variable (increase it), such as ticks in kern/driver/clock.c
         * (2) Every TICK_NUM cycle, you can print some info using a funciton, such as print_ticks().
         * (3) Too Simple? Yes, I think so!
         */
	ticks++;
c0102779:	a1 54 e0 12 c0       	mov    0xc012e054,%eax
c010277e:	40                   	inc    %eax
c010277f:	a3 54 e0 12 c0       	mov    %eax,0xc012e054
	if(!(ticks%TICK_NUM)) print_ticks();
c0102784:	8b 0d 54 e0 12 c0    	mov    0xc012e054,%ecx
c010278a:	ba 1f 85 eb 51       	mov    $0x51eb851f,%edx
c010278f:	89 c8                	mov    %ecx,%eax
c0102791:	f7 e2                	mul    %edx
c0102793:	c1 ea 05             	shr    $0x5,%edx
c0102796:	89 d0                	mov    %edx,%eax
c0102798:	c1 e0 02             	shl    $0x2,%eax
c010279b:	01 d0                	add    %edx,%eax
c010279d:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01027a4:	01 d0                	add    %edx,%eax
c01027a6:	c1 e0 02             	shl    $0x2,%eax
c01027a9:	29 c1                	sub    %eax,%ecx
c01027ab:	89 ca                	mov    %ecx,%edx
c01027ad:	85 d2                	test   %edx,%edx
c01027af:	0f 85 ad 00 00 00    	jne    c0102862 <trap_dispatch+0x174>
c01027b5:	e8 56 fa ff ff       	call   c0102210 <print_ticks>
        break;
c01027ba:	e9 a3 00 00 00       	jmp    c0102862 <trap_dispatch+0x174>
    case IRQ_OFFSET + IRQ_COM1:
        c = cons_getc();
c01027bf:	e8 df f7 ff ff       	call   c0101fa3 <cons_getc>
c01027c4:	88 45 f7             	mov    %al,-0x9(%ebp)
        cprintf("serial [%03d] %c\n", c, c);
c01027c7:	0f be 55 f7          	movsbl -0x9(%ebp),%edx
c01027cb:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c01027cf:	89 54 24 08          	mov    %edx,0x8(%esp)
c01027d3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01027d7:	c7 04 24 3d a7 10 c0 	movl   $0xc010a73d,(%esp)
c01027de:	e8 ee da ff ff       	call   c01002d1 <cprintf>
        break;
c01027e3:	eb 7e                	jmp    c0102863 <trap_dispatch+0x175>
    case IRQ_OFFSET + IRQ_KBD:
        c = cons_getc();
c01027e5:	e8 b9 f7 ff ff       	call   c0101fa3 <cons_getc>
c01027ea:	88 45 f7             	mov    %al,-0x9(%ebp)
        cprintf("kbd [%03d] %c\n", c, c);
c01027ed:	0f be 55 f7          	movsbl -0x9(%ebp),%edx
c01027f1:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c01027f5:	89 54 24 08          	mov    %edx,0x8(%esp)
c01027f9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01027fd:	c7 04 24 4f a7 10 c0 	movl   $0xc010a74f,(%esp)
c0102804:	e8 c8 da ff ff       	call   c01002d1 <cprintf>
        break;
c0102809:	eb 58                	jmp    c0102863 <trap_dispatch+0x175>
    //LAB1 CHALLENGE 1 : YOUR CODE you should modify below codes.
    case T_SWITCH_TOU:
    case T_SWITCH_TOK:
        panic("T_SWITCH_** ??\n");
c010280b:	c7 44 24 08 5e a7 10 	movl   $0xc010a75e,0x8(%esp)
c0102812:	c0 
c0102813:	c7 44 24 04 d0 00 00 	movl   $0xd0,0x4(%esp)
c010281a:	00 
c010281b:	c7 04 24 0e a5 10 c0 	movl   $0xc010a50e,(%esp)
c0102822:	e8 16 dc ff ff       	call   c010043d <__panic>
    case IRQ_OFFSET + IRQ_IDE2:
        /* do nothing */
        break;
    default:
        // in kernel, it must be a mistake
        if ((tf->tf_cs & 3) == 0) {
c0102827:	8b 45 08             	mov    0x8(%ebp),%eax
c010282a:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c010282e:	83 e0 03             	and    $0x3,%eax
c0102831:	85 c0                	test   %eax,%eax
c0102833:	75 2e                	jne    c0102863 <trap_dispatch+0x175>
            print_trapframe(tf);
c0102835:	8b 45 08             	mov    0x8(%ebp),%eax
c0102838:	89 04 24             	mov    %eax,(%esp)
c010283b:	e8 5d fb ff ff       	call   c010239d <print_trapframe>
            panic("unexpected trap in kernel.\n");
c0102840:	c7 44 24 08 6e a7 10 	movl   $0xc010a76e,0x8(%esp)
c0102847:	c0 
c0102848:	c7 44 24 04 da 00 00 	movl   $0xda,0x4(%esp)
c010284f:	00 
c0102850:	c7 04 24 0e a5 10 c0 	movl   $0xc010a50e,(%esp)
c0102857:	e8 e1 db ff ff       	call   c010043d <__panic>
        break;
c010285c:	90                   	nop
c010285d:	eb 04                	jmp    c0102863 <trap_dispatch+0x175>
        break;
c010285f:	90                   	nop
c0102860:	eb 01                	jmp    c0102863 <trap_dispatch+0x175>
        break;
c0102862:	90                   	nop
        }
    }
}
c0102863:	90                   	nop
c0102864:	c9                   	leave  
c0102865:	c3                   	ret    

c0102866 <trap>:
 * trap - handles or dispatches an exception/interrupt. if and when trap() returns,
 * the code in kern/trap/trapentry.S restores the old CPU state saved in the
 * trapframe and then uses the iret instruction to return from the exception.
 * */
void
trap(struct trapframe *tf) {
c0102866:	f3 0f 1e fb          	endbr32 
c010286a:	55                   	push   %ebp
c010286b:	89 e5                	mov    %esp,%ebp
c010286d:	83 ec 18             	sub    $0x18,%esp
    // dispatch based on what type of trap occurred
    trap_dispatch(tf);
c0102870:	8b 45 08             	mov    0x8(%ebp),%eax
c0102873:	89 04 24             	mov    %eax,(%esp)
c0102876:	e8 73 fe ff ff       	call   c01026ee <trap_dispatch>
}
c010287b:	90                   	nop
c010287c:	c9                   	leave  
c010287d:	c3                   	ret    

c010287e <vector0>:
# handler
.text
.globl __alltraps
.globl vector0
vector0:
  pushl $0
c010287e:	6a 00                	push   $0x0
  pushl $0
c0102880:	6a 00                	push   $0x0
  jmp __alltraps
c0102882:	e9 69 0a 00 00       	jmp    c01032f0 <__alltraps>

c0102887 <vector1>:
.globl vector1
vector1:
  pushl $0
c0102887:	6a 00                	push   $0x0
  pushl $1
c0102889:	6a 01                	push   $0x1
  jmp __alltraps
c010288b:	e9 60 0a 00 00       	jmp    c01032f0 <__alltraps>

c0102890 <vector2>:
.globl vector2
vector2:
  pushl $0
c0102890:	6a 00                	push   $0x0
  pushl $2
c0102892:	6a 02                	push   $0x2
  jmp __alltraps
c0102894:	e9 57 0a 00 00       	jmp    c01032f0 <__alltraps>

c0102899 <vector3>:
.globl vector3
vector3:
  pushl $0
c0102899:	6a 00                	push   $0x0
  pushl $3
c010289b:	6a 03                	push   $0x3
  jmp __alltraps
c010289d:	e9 4e 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028a2 <vector4>:
.globl vector4
vector4:
  pushl $0
c01028a2:	6a 00                	push   $0x0
  pushl $4
c01028a4:	6a 04                	push   $0x4
  jmp __alltraps
c01028a6:	e9 45 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028ab <vector5>:
.globl vector5
vector5:
  pushl $0
c01028ab:	6a 00                	push   $0x0
  pushl $5
c01028ad:	6a 05                	push   $0x5
  jmp __alltraps
c01028af:	e9 3c 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028b4 <vector6>:
.globl vector6
vector6:
  pushl $0
c01028b4:	6a 00                	push   $0x0
  pushl $6
c01028b6:	6a 06                	push   $0x6
  jmp __alltraps
c01028b8:	e9 33 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028bd <vector7>:
.globl vector7
vector7:
  pushl $0
c01028bd:	6a 00                	push   $0x0
  pushl $7
c01028bf:	6a 07                	push   $0x7
  jmp __alltraps
c01028c1:	e9 2a 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028c6 <vector8>:
.globl vector8
vector8:
  pushl $8
c01028c6:	6a 08                	push   $0x8
  jmp __alltraps
c01028c8:	e9 23 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028cd <vector9>:
.globl vector9
vector9:
  pushl $0
c01028cd:	6a 00                	push   $0x0
  pushl $9
c01028cf:	6a 09                	push   $0x9
  jmp __alltraps
c01028d1:	e9 1a 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028d6 <vector10>:
.globl vector10
vector10:
  pushl $10
c01028d6:	6a 0a                	push   $0xa
  jmp __alltraps
c01028d8:	e9 13 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028dd <vector11>:
.globl vector11
vector11:
  pushl $11
c01028dd:	6a 0b                	push   $0xb
  jmp __alltraps
c01028df:	e9 0c 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028e4 <vector12>:
.globl vector12
vector12:
  pushl $12
c01028e4:	6a 0c                	push   $0xc
  jmp __alltraps
c01028e6:	e9 05 0a 00 00       	jmp    c01032f0 <__alltraps>

c01028eb <vector13>:
.globl vector13
vector13:
  pushl $13
c01028eb:	6a 0d                	push   $0xd
  jmp __alltraps
c01028ed:	e9 fe 09 00 00       	jmp    c01032f0 <__alltraps>

c01028f2 <vector14>:
.globl vector14
vector14:
  pushl $14
c01028f2:	6a 0e                	push   $0xe
  jmp __alltraps
c01028f4:	e9 f7 09 00 00       	jmp    c01032f0 <__alltraps>

c01028f9 <vector15>:
.globl vector15
vector15:
  pushl $0
c01028f9:	6a 00                	push   $0x0
  pushl $15
c01028fb:	6a 0f                	push   $0xf
  jmp __alltraps
c01028fd:	e9 ee 09 00 00       	jmp    c01032f0 <__alltraps>

c0102902 <vector16>:
.globl vector16
vector16:
  pushl $0
c0102902:	6a 00                	push   $0x0
  pushl $16
c0102904:	6a 10                	push   $0x10
  jmp __alltraps
c0102906:	e9 e5 09 00 00       	jmp    c01032f0 <__alltraps>

c010290b <vector17>:
.globl vector17
vector17:
  pushl $17
c010290b:	6a 11                	push   $0x11
  jmp __alltraps
c010290d:	e9 de 09 00 00       	jmp    c01032f0 <__alltraps>

c0102912 <vector18>:
.globl vector18
vector18:
  pushl $0
c0102912:	6a 00                	push   $0x0
  pushl $18
c0102914:	6a 12                	push   $0x12
  jmp __alltraps
c0102916:	e9 d5 09 00 00       	jmp    c01032f0 <__alltraps>

c010291b <vector19>:
.globl vector19
vector19:
  pushl $0
c010291b:	6a 00                	push   $0x0
  pushl $19
c010291d:	6a 13                	push   $0x13
  jmp __alltraps
c010291f:	e9 cc 09 00 00       	jmp    c01032f0 <__alltraps>

c0102924 <vector20>:
.globl vector20
vector20:
  pushl $0
c0102924:	6a 00                	push   $0x0
  pushl $20
c0102926:	6a 14                	push   $0x14
  jmp __alltraps
c0102928:	e9 c3 09 00 00       	jmp    c01032f0 <__alltraps>

c010292d <vector21>:
.globl vector21
vector21:
  pushl $0
c010292d:	6a 00                	push   $0x0
  pushl $21
c010292f:	6a 15                	push   $0x15
  jmp __alltraps
c0102931:	e9 ba 09 00 00       	jmp    c01032f0 <__alltraps>

c0102936 <vector22>:
.globl vector22
vector22:
  pushl $0
c0102936:	6a 00                	push   $0x0
  pushl $22
c0102938:	6a 16                	push   $0x16
  jmp __alltraps
c010293a:	e9 b1 09 00 00       	jmp    c01032f0 <__alltraps>

c010293f <vector23>:
.globl vector23
vector23:
  pushl $0
c010293f:	6a 00                	push   $0x0
  pushl $23
c0102941:	6a 17                	push   $0x17
  jmp __alltraps
c0102943:	e9 a8 09 00 00       	jmp    c01032f0 <__alltraps>

c0102948 <vector24>:
.globl vector24
vector24:
  pushl $0
c0102948:	6a 00                	push   $0x0
  pushl $24
c010294a:	6a 18                	push   $0x18
  jmp __alltraps
c010294c:	e9 9f 09 00 00       	jmp    c01032f0 <__alltraps>

c0102951 <vector25>:
.globl vector25
vector25:
  pushl $0
c0102951:	6a 00                	push   $0x0
  pushl $25
c0102953:	6a 19                	push   $0x19
  jmp __alltraps
c0102955:	e9 96 09 00 00       	jmp    c01032f0 <__alltraps>

c010295a <vector26>:
.globl vector26
vector26:
  pushl $0
c010295a:	6a 00                	push   $0x0
  pushl $26
c010295c:	6a 1a                	push   $0x1a
  jmp __alltraps
c010295e:	e9 8d 09 00 00       	jmp    c01032f0 <__alltraps>

c0102963 <vector27>:
.globl vector27
vector27:
  pushl $0
c0102963:	6a 00                	push   $0x0
  pushl $27
c0102965:	6a 1b                	push   $0x1b
  jmp __alltraps
c0102967:	e9 84 09 00 00       	jmp    c01032f0 <__alltraps>

c010296c <vector28>:
.globl vector28
vector28:
  pushl $0
c010296c:	6a 00                	push   $0x0
  pushl $28
c010296e:	6a 1c                	push   $0x1c
  jmp __alltraps
c0102970:	e9 7b 09 00 00       	jmp    c01032f0 <__alltraps>

c0102975 <vector29>:
.globl vector29
vector29:
  pushl $0
c0102975:	6a 00                	push   $0x0
  pushl $29
c0102977:	6a 1d                	push   $0x1d
  jmp __alltraps
c0102979:	e9 72 09 00 00       	jmp    c01032f0 <__alltraps>

c010297e <vector30>:
.globl vector30
vector30:
  pushl $0
c010297e:	6a 00                	push   $0x0
  pushl $30
c0102980:	6a 1e                	push   $0x1e
  jmp __alltraps
c0102982:	e9 69 09 00 00       	jmp    c01032f0 <__alltraps>

c0102987 <vector31>:
.globl vector31
vector31:
  pushl $0
c0102987:	6a 00                	push   $0x0
  pushl $31
c0102989:	6a 1f                	push   $0x1f
  jmp __alltraps
c010298b:	e9 60 09 00 00       	jmp    c01032f0 <__alltraps>

c0102990 <vector32>:
.globl vector32
vector32:
  pushl $0
c0102990:	6a 00                	push   $0x0
  pushl $32
c0102992:	6a 20                	push   $0x20
  jmp __alltraps
c0102994:	e9 57 09 00 00       	jmp    c01032f0 <__alltraps>

c0102999 <vector33>:
.globl vector33
vector33:
  pushl $0
c0102999:	6a 00                	push   $0x0
  pushl $33
c010299b:	6a 21                	push   $0x21
  jmp __alltraps
c010299d:	e9 4e 09 00 00       	jmp    c01032f0 <__alltraps>

c01029a2 <vector34>:
.globl vector34
vector34:
  pushl $0
c01029a2:	6a 00                	push   $0x0
  pushl $34
c01029a4:	6a 22                	push   $0x22
  jmp __alltraps
c01029a6:	e9 45 09 00 00       	jmp    c01032f0 <__alltraps>

c01029ab <vector35>:
.globl vector35
vector35:
  pushl $0
c01029ab:	6a 00                	push   $0x0
  pushl $35
c01029ad:	6a 23                	push   $0x23
  jmp __alltraps
c01029af:	e9 3c 09 00 00       	jmp    c01032f0 <__alltraps>

c01029b4 <vector36>:
.globl vector36
vector36:
  pushl $0
c01029b4:	6a 00                	push   $0x0
  pushl $36
c01029b6:	6a 24                	push   $0x24
  jmp __alltraps
c01029b8:	e9 33 09 00 00       	jmp    c01032f0 <__alltraps>

c01029bd <vector37>:
.globl vector37
vector37:
  pushl $0
c01029bd:	6a 00                	push   $0x0
  pushl $37
c01029bf:	6a 25                	push   $0x25
  jmp __alltraps
c01029c1:	e9 2a 09 00 00       	jmp    c01032f0 <__alltraps>

c01029c6 <vector38>:
.globl vector38
vector38:
  pushl $0
c01029c6:	6a 00                	push   $0x0
  pushl $38
c01029c8:	6a 26                	push   $0x26
  jmp __alltraps
c01029ca:	e9 21 09 00 00       	jmp    c01032f0 <__alltraps>

c01029cf <vector39>:
.globl vector39
vector39:
  pushl $0
c01029cf:	6a 00                	push   $0x0
  pushl $39
c01029d1:	6a 27                	push   $0x27
  jmp __alltraps
c01029d3:	e9 18 09 00 00       	jmp    c01032f0 <__alltraps>

c01029d8 <vector40>:
.globl vector40
vector40:
  pushl $0
c01029d8:	6a 00                	push   $0x0
  pushl $40
c01029da:	6a 28                	push   $0x28
  jmp __alltraps
c01029dc:	e9 0f 09 00 00       	jmp    c01032f0 <__alltraps>

c01029e1 <vector41>:
.globl vector41
vector41:
  pushl $0
c01029e1:	6a 00                	push   $0x0
  pushl $41
c01029e3:	6a 29                	push   $0x29
  jmp __alltraps
c01029e5:	e9 06 09 00 00       	jmp    c01032f0 <__alltraps>

c01029ea <vector42>:
.globl vector42
vector42:
  pushl $0
c01029ea:	6a 00                	push   $0x0
  pushl $42
c01029ec:	6a 2a                	push   $0x2a
  jmp __alltraps
c01029ee:	e9 fd 08 00 00       	jmp    c01032f0 <__alltraps>

c01029f3 <vector43>:
.globl vector43
vector43:
  pushl $0
c01029f3:	6a 00                	push   $0x0
  pushl $43
c01029f5:	6a 2b                	push   $0x2b
  jmp __alltraps
c01029f7:	e9 f4 08 00 00       	jmp    c01032f0 <__alltraps>

c01029fc <vector44>:
.globl vector44
vector44:
  pushl $0
c01029fc:	6a 00                	push   $0x0
  pushl $44
c01029fe:	6a 2c                	push   $0x2c
  jmp __alltraps
c0102a00:	e9 eb 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a05 <vector45>:
.globl vector45
vector45:
  pushl $0
c0102a05:	6a 00                	push   $0x0
  pushl $45
c0102a07:	6a 2d                	push   $0x2d
  jmp __alltraps
c0102a09:	e9 e2 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a0e <vector46>:
.globl vector46
vector46:
  pushl $0
c0102a0e:	6a 00                	push   $0x0
  pushl $46
c0102a10:	6a 2e                	push   $0x2e
  jmp __alltraps
c0102a12:	e9 d9 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a17 <vector47>:
.globl vector47
vector47:
  pushl $0
c0102a17:	6a 00                	push   $0x0
  pushl $47
c0102a19:	6a 2f                	push   $0x2f
  jmp __alltraps
c0102a1b:	e9 d0 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a20 <vector48>:
.globl vector48
vector48:
  pushl $0
c0102a20:	6a 00                	push   $0x0
  pushl $48
c0102a22:	6a 30                	push   $0x30
  jmp __alltraps
c0102a24:	e9 c7 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a29 <vector49>:
.globl vector49
vector49:
  pushl $0
c0102a29:	6a 00                	push   $0x0
  pushl $49
c0102a2b:	6a 31                	push   $0x31
  jmp __alltraps
c0102a2d:	e9 be 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a32 <vector50>:
.globl vector50
vector50:
  pushl $0
c0102a32:	6a 00                	push   $0x0
  pushl $50
c0102a34:	6a 32                	push   $0x32
  jmp __alltraps
c0102a36:	e9 b5 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a3b <vector51>:
.globl vector51
vector51:
  pushl $0
c0102a3b:	6a 00                	push   $0x0
  pushl $51
c0102a3d:	6a 33                	push   $0x33
  jmp __alltraps
c0102a3f:	e9 ac 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a44 <vector52>:
.globl vector52
vector52:
  pushl $0
c0102a44:	6a 00                	push   $0x0
  pushl $52
c0102a46:	6a 34                	push   $0x34
  jmp __alltraps
c0102a48:	e9 a3 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a4d <vector53>:
.globl vector53
vector53:
  pushl $0
c0102a4d:	6a 00                	push   $0x0
  pushl $53
c0102a4f:	6a 35                	push   $0x35
  jmp __alltraps
c0102a51:	e9 9a 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a56 <vector54>:
.globl vector54
vector54:
  pushl $0
c0102a56:	6a 00                	push   $0x0
  pushl $54
c0102a58:	6a 36                	push   $0x36
  jmp __alltraps
c0102a5a:	e9 91 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a5f <vector55>:
.globl vector55
vector55:
  pushl $0
c0102a5f:	6a 00                	push   $0x0
  pushl $55
c0102a61:	6a 37                	push   $0x37
  jmp __alltraps
c0102a63:	e9 88 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a68 <vector56>:
.globl vector56
vector56:
  pushl $0
c0102a68:	6a 00                	push   $0x0
  pushl $56
c0102a6a:	6a 38                	push   $0x38
  jmp __alltraps
c0102a6c:	e9 7f 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a71 <vector57>:
.globl vector57
vector57:
  pushl $0
c0102a71:	6a 00                	push   $0x0
  pushl $57
c0102a73:	6a 39                	push   $0x39
  jmp __alltraps
c0102a75:	e9 76 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a7a <vector58>:
.globl vector58
vector58:
  pushl $0
c0102a7a:	6a 00                	push   $0x0
  pushl $58
c0102a7c:	6a 3a                	push   $0x3a
  jmp __alltraps
c0102a7e:	e9 6d 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a83 <vector59>:
.globl vector59
vector59:
  pushl $0
c0102a83:	6a 00                	push   $0x0
  pushl $59
c0102a85:	6a 3b                	push   $0x3b
  jmp __alltraps
c0102a87:	e9 64 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a8c <vector60>:
.globl vector60
vector60:
  pushl $0
c0102a8c:	6a 00                	push   $0x0
  pushl $60
c0102a8e:	6a 3c                	push   $0x3c
  jmp __alltraps
c0102a90:	e9 5b 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a95 <vector61>:
.globl vector61
vector61:
  pushl $0
c0102a95:	6a 00                	push   $0x0
  pushl $61
c0102a97:	6a 3d                	push   $0x3d
  jmp __alltraps
c0102a99:	e9 52 08 00 00       	jmp    c01032f0 <__alltraps>

c0102a9e <vector62>:
.globl vector62
vector62:
  pushl $0
c0102a9e:	6a 00                	push   $0x0
  pushl $62
c0102aa0:	6a 3e                	push   $0x3e
  jmp __alltraps
c0102aa2:	e9 49 08 00 00       	jmp    c01032f0 <__alltraps>

c0102aa7 <vector63>:
.globl vector63
vector63:
  pushl $0
c0102aa7:	6a 00                	push   $0x0
  pushl $63
c0102aa9:	6a 3f                	push   $0x3f
  jmp __alltraps
c0102aab:	e9 40 08 00 00       	jmp    c01032f0 <__alltraps>

c0102ab0 <vector64>:
.globl vector64
vector64:
  pushl $0
c0102ab0:	6a 00                	push   $0x0
  pushl $64
c0102ab2:	6a 40                	push   $0x40
  jmp __alltraps
c0102ab4:	e9 37 08 00 00       	jmp    c01032f0 <__alltraps>

c0102ab9 <vector65>:
.globl vector65
vector65:
  pushl $0
c0102ab9:	6a 00                	push   $0x0
  pushl $65
c0102abb:	6a 41                	push   $0x41
  jmp __alltraps
c0102abd:	e9 2e 08 00 00       	jmp    c01032f0 <__alltraps>

c0102ac2 <vector66>:
.globl vector66
vector66:
  pushl $0
c0102ac2:	6a 00                	push   $0x0
  pushl $66
c0102ac4:	6a 42                	push   $0x42
  jmp __alltraps
c0102ac6:	e9 25 08 00 00       	jmp    c01032f0 <__alltraps>

c0102acb <vector67>:
.globl vector67
vector67:
  pushl $0
c0102acb:	6a 00                	push   $0x0
  pushl $67
c0102acd:	6a 43                	push   $0x43
  jmp __alltraps
c0102acf:	e9 1c 08 00 00       	jmp    c01032f0 <__alltraps>

c0102ad4 <vector68>:
.globl vector68
vector68:
  pushl $0
c0102ad4:	6a 00                	push   $0x0
  pushl $68
c0102ad6:	6a 44                	push   $0x44
  jmp __alltraps
c0102ad8:	e9 13 08 00 00       	jmp    c01032f0 <__alltraps>

c0102add <vector69>:
.globl vector69
vector69:
  pushl $0
c0102add:	6a 00                	push   $0x0
  pushl $69
c0102adf:	6a 45                	push   $0x45
  jmp __alltraps
c0102ae1:	e9 0a 08 00 00       	jmp    c01032f0 <__alltraps>

c0102ae6 <vector70>:
.globl vector70
vector70:
  pushl $0
c0102ae6:	6a 00                	push   $0x0
  pushl $70
c0102ae8:	6a 46                	push   $0x46
  jmp __alltraps
c0102aea:	e9 01 08 00 00       	jmp    c01032f0 <__alltraps>

c0102aef <vector71>:
.globl vector71
vector71:
  pushl $0
c0102aef:	6a 00                	push   $0x0
  pushl $71
c0102af1:	6a 47                	push   $0x47
  jmp __alltraps
c0102af3:	e9 f8 07 00 00       	jmp    c01032f0 <__alltraps>

c0102af8 <vector72>:
.globl vector72
vector72:
  pushl $0
c0102af8:	6a 00                	push   $0x0
  pushl $72
c0102afa:	6a 48                	push   $0x48
  jmp __alltraps
c0102afc:	e9 ef 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b01 <vector73>:
.globl vector73
vector73:
  pushl $0
c0102b01:	6a 00                	push   $0x0
  pushl $73
c0102b03:	6a 49                	push   $0x49
  jmp __alltraps
c0102b05:	e9 e6 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b0a <vector74>:
.globl vector74
vector74:
  pushl $0
c0102b0a:	6a 00                	push   $0x0
  pushl $74
c0102b0c:	6a 4a                	push   $0x4a
  jmp __alltraps
c0102b0e:	e9 dd 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b13 <vector75>:
.globl vector75
vector75:
  pushl $0
c0102b13:	6a 00                	push   $0x0
  pushl $75
c0102b15:	6a 4b                	push   $0x4b
  jmp __alltraps
c0102b17:	e9 d4 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b1c <vector76>:
.globl vector76
vector76:
  pushl $0
c0102b1c:	6a 00                	push   $0x0
  pushl $76
c0102b1e:	6a 4c                	push   $0x4c
  jmp __alltraps
c0102b20:	e9 cb 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b25 <vector77>:
.globl vector77
vector77:
  pushl $0
c0102b25:	6a 00                	push   $0x0
  pushl $77
c0102b27:	6a 4d                	push   $0x4d
  jmp __alltraps
c0102b29:	e9 c2 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b2e <vector78>:
.globl vector78
vector78:
  pushl $0
c0102b2e:	6a 00                	push   $0x0
  pushl $78
c0102b30:	6a 4e                	push   $0x4e
  jmp __alltraps
c0102b32:	e9 b9 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b37 <vector79>:
.globl vector79
vector79:
  pushl $0
c0102b37:	6a 00                	push   $0x0
  pushl $79
c0102b39:	6a 4f                	push   $0x4f
  jmp __alltraps
c0102b3b:	e9 b0 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b40 <vector80>:
.globl vector80
vector80:
  pushl $0
c0102b40:	6a 00                	push   $0x0
  pushl $80
c0102b42:	6a 50                	push   $0x50
  jmp __alltraps
c0102b44:	e9 a7 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b49 <vector81>:
.globl vector81
vector81:
  pushl $0
c0102b49:	6a 00                	push   $0x0
  pushl $81
c0102b4b:	6a 51                	push   $0x51
  jmp __alltraps
c0102b4d:	e9 9e 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b52 <vector82>:
.globl vector82
vector82:
  pushl $0
c0102b52:	6a 00                	push   $0x0
  pushl $82
c0102b54:	6a 52                	push   $0x52
  jmp __alltraps
c0102b56:	e9 95 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b5b <vector83>:
.globl vector83
vector83:
  pushl $0
c0102b5b:	6a 00                	push   $0x0
  pushl $83
c0102b5d:	6a 53                	push   $0x53
  jmp __alltraps
c0102b5f:	e9 8c 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b64 <vector84>:
.globl vector84
vector84:
  pushl $0
c0102b64:	6a 00                	push   $0x0
  pushl $84
c0102b66:	6a 54                	push   $0x54
  jmp __alltraps
c0102b68:	e9 83 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b6d <vector85>:
.globl vector85
vector85:
  pushl $0
c0102b6d:	6a 00                	push   $0x0
  pushl $85
c0102b6f:	6a 55                	push   $0x55
  jmp __alltraps
c0102b71:	e9 7a 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b76 <vector86>:
.globl vector86
vector86:
  pushl $0
c0102b76:	6a 00                	push   $0x0
  pushl $86
c0102b78:	6a 56                	push   $0x56
  jmp __alltraps
c0102b7a:	e9 71 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b7f <vector87>:
.globl vector87
vector87:
  pushl $0
c0102b7f:	6a 00                	push   $0x0
  pushl $87
c0102b81:	6a 57                	push   $0x57
  jmp __alltraps
c0102b83:	e9 68 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b88 <vector88>:
.globl vector88
vector88:
  pushl $0
c0102b88:	6a 00                	push   $0x0
  pushl $88
c0102b8a:	6a 58                	push   $0x58
  jmp __alltraps
c0102b8c:	e9 5f 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b91 <vector89>:
.globl vector89
vector89:
  pushl $0
c0102b91:	6a 00                	push   $0x0
  pushl $89
c0102b93:	6a 59                	push   $0x59
  jmp __alltraps
c0102b95:	e9 56 07 00 00       	jmp    c01032f0 <__alltraps>

c0102b9a <vector90>:
.globl vector90
vector90:
  pushl $0
c0102b9a:	6a 00                	push   $0x0
  pushl $90
c0102b9c:	6a 5a                	push   $0x5a
  jmp __alltraps
c0102b9e:	e9 4d 07 00 00       	jmp    c01032f0 <__alltraps>

c0102ba3 <vector91>:
.globl vector91
vector91:
  pushl $0
c0102ba3:	6a 00                	push   $0x0
  pushl $91
c0102ba5:	6a 5b                	push   $0x5b
  jmp __alltraps
c0102ba7:	e9 44 07 00 00       	jmp    c01032f0 <__alltraps>

c0102bac <vector92>:
.globl vector92
vector92:
  pushl $0
c0102bac:	6a 00                	push   $0x0
  pushl $92
c0102bae:	6a 5c                	push   $0x5c
  jmp __alltraps
c0102bb0:	e9 3b 07 00 00       	jmp    c01032f0 <__alltraps>

c0102bb5 <vector93>:
.globl vector93
vector93:
  pushl $0
c0102bb5:	6a 00                	push   $0x0
  pushl $93
c0102bb7:	6a 5d                	push   $0x5d
  jmp __alltraps
c0102bb9:	e9 32 07 00 00       	jmp    c01032f0 <__alltraps>

c0102bbe <vector94>:
.globl vector94
vector94:
  pushl $0
c0102bbe:	6a 00                	push   $0x0
  pushl $94
c0102bc0:	6a 5e                	push   $0x5e
  jmp __alltraps
c0102bc2:	e9 29 07 00 00       	jmp    c01032f0 <__alltraps>

c0102bc7 <vector95>:
.globl vector95
vector95:
  pushl $0
c0102bc7:	6a 00                	push   $0x0
  pushl $95
c0102bc9:	6a 5f                	push   $0x5f
  jmp __alltraps
c0102bcb:	e9 20 07 00 00       	jmp    c01032f0 <__alltraps>

c0102bd0 <vector96>:
.globl vector96
vector96:
  pushl $0
c0102bd0:	6a 00                	push   $0x0
  pushl $96
c0102bd2:	6a 60                	push   $0x60
  jmp __alltraps
c0102bd4:	e9 17 07 00 00       	jmp    c01032f0 <__alltraps>

c0102bd9 <vector97>:
.globl vector97
vector97:
  pushl $0
c0102bd9:	6a 00                	push   $0x0
  pushl $97
c0102bdb:	6a 61                	push   $0x61
  jmp __alltraps
c0102bdd:	e9 0e 07 00 00       	jmp    c01032f0 <__alltraps>

c0102be2 <vector98>:
.globl vector98
vector98:
  pushl $0
c0102be2:	6a 00                	push   $0x0
  pushl $98
c0102be4:	6a 62                	push   $0x62
  jmp __alltraps
c0102be6:	e9 05 07 00 00       	jmp    c01032f0 <__alltraps>

c0102beb <vector99>:
.globl vector99
vector99:
  pushl $0
c0102beb:	6a 00                	push   $0x0
  pushl $99
c0102bed:	6a 63                	push   $0x63
  jmp __alltraps
c0102bef:	e9 fc 06 00 00       	jmp    c01032f0 <__alltraps>

c0102bf4 <vector100>:
.globl vector100
vector100:
  pushl $0
c0102bf4:	6a 00                	push   $0x0
  pushl $100
c0102bf6:	6a 64                	push   $0x64
  jmp __alltraps
c0102bf8:	e9 f3 06 00 00       	jmp    c01032f0 <__alltraps>

c0102bfd <vector101>:
.globl vector101
vector101:
  pushl $0
c0102bfd:	6a 00                	push   $0x0
  pushl $101
c0102bff:	6a 65                	push   $0x65
  jmp __alltraps
c0102c01:	e9 ea 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c06 <vector102>:
.globl vector102
vector102:
  pushl $0
c0102c06:	6a 00                	push   $0x0
  pushl $102
c0102c08:	6a 66                	push   $0x66
  jmp __alltraps
c0102c0a:	e9 e1 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c0f <vector103>:
.globl vector103
vector103:
  pushl $0
c0102c0f:	6a 00                	push   $0x0
  pushl $103
c0102c11:	6a 67                	push   $0x67
  jmp __alltraps
c0102c13:	e9 d8 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c18 <vector104>:
.globl vector104
vector104:
  pushl $0
c0102c18:	6a 00                	push   $0x0
  pushl $104
c0102c1a:	6a 68                	push   $0x68
  jmp __alltraps
c0102c1c:	e9 cf 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c21 <vector105>:
.globl vector105
vector105:
  pushl $0
c0102c21:	6a 00                	push   $0x0
  pushl $105
c0102c23:	6a 69                	push   $0x69
  jmp __alltraps
c0102c25:	e9 c6 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c2a <vector106>:
.globl vector106
vector106:
  pushl $0
c0102c2a:	6a 00                	push   $0x0
  pushl $106
c0102c2c:	6a 6a                	push   $0x6a
  jmp __alltraps
c0102c2e:	e9 bd 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c33 <vector107>:
.globl vector107
vector107:
  pushl $0
c0102c33:	6a 00                	push   $0x0
  pushl $107
c0102c35:	6a 6b                	push   $0x6b
  jmp __alltraps
c0102c37:	e9 b4 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c3c <vector108>:
.globl vector108
vector108:
  pushl $0
c0102c3c:	6a 00                	push   $0x0
  pushl $108
c0102c3e:	6a 6c                	push   $0x6c
  jmp __alltraps
c0102c40:	e9 ab 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c45 <vector109>:
.globl vector109
vector109:
  pushl $0
c0102c45:	6a 00                	push   $0x0
  pushl $109
c0102c47:	6a 6d                	push   $0x6d
  jmp __alltraps
c0102c49:	e9 a2 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c4e <vector110>:
.globl vector110
vector110:
  pushl $0
c0102c4e:	6a 00                	push   $0x0
  pushl $110
c0102c50:	6a 6e                	push   $0x6e
  jmp __alltraps
c0102c52:	e9 99 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c57 <vector111>:
.globl vector111
vector111:
  pushl $0
c0102c57:	6a 00                	push   $0x0
  pushl $111
c0102c59:	6a 6f                	push   $0x6f
  jmp __alltraps
c0102c5b:	e9 90 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c60 <vector112>:
.globl vector112
vector112:
  pushl $0
c0102c60:	6a 00                	push   $0x0
  pushl $112
c0102c62:	6a 70                	push   $0x70
  jmp __alltraps
c0102c64:	e9 87 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c69 <vector113>:
.globl vector113
vector113:
  pushl $0
c0102c69:	6a 00                	push   $0x0
  pushl $113
c0102c6b:	6a 71                	push   $0x71
  jmp __alltraps
c0102c6d:	e9 7e 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c72 <vector114>:
.globl vector114
vector114:
  pushl $0
c0102c72:	6a 00                	push   $0x0
  pushl $114
c0102c74:	6a 72                	push   $0x72
  jmp __alltraps
c0102c76:	e9 75 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c7b <vector115>:
.globl vector115
vector115:
  pushl $0
c0102c7b:	6a 00                	push   $0x0
  pushl $115
c0102c7d:	6a 73                	push   $0x73
  jmp __alltraps
c0102c7f:	e9 6c 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c84 <vector116>:
.globl vector116
vector116:
  pushl $0
c0102c84:	6a 00                	push   $0x0
  pushl $116
c0102c86:	6a 74                	push   $0x74
  jmp __alltraps
c0102c88:	e9 63 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c8d <vector117>:
.globl vector117
vector117:
  pushl $0
c0102c8d:	6a 00                	push   $0x0
  pushl $117
c0102c8f:	6a 75                	push   $0x75
  jmp __alltraps
c0102c91:	e9 5a 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c96 <vector118>:
.globl vector118
vector118:
  pushl $0
c0102c96:	6a 00                	push   $0x0
  pushl $118
c0102c98:	6a 76                	push   $0x76
  jmp __alltraps
c0102c9a:	e9 51 06 00 00       	jmp    c01032f0 <__alltraps>

c0102c9f <vector119>:
.globl vector119
vector119:
  pushl $0
c0102c9f:	6a 00                	push   $0x0
  pushl $119
c0102ca1:	6a 77                	push   $0x77
  jmp __alltraps
c0102ca3:	e9 48 06 00 00       	jmp    c01032f0 <__alltraps>

c0102ca8 <vector120>:
.globl vector120
vector120:
  pushl $0
c0102ca8:	6a 00                	push   $0x0
  pushl $120
c0102caa:	6a 78                	push   $0x78
  jmp __alltraps
c0102cac:	e9 3f 06 00 00       	jmp    c01032f0 <__alltraps>

c0102cb1 <vector121>:
.globl vector121
vector121:
  pushl $0
c0102cb1:	6a 00                	push   $0x0
  pushl $121
c0102cb3:	6a 79                	push   $0x79
  jmp __alltraps
c0102cb5:	e9 36 06 00 00       	jmp    c01032f0 <__alltraps>

c0102cba <vector122>:
.globl vector122
vector122:
  pushl $0
c0102cba:	6a 00                	push   $0x0
  pushl $122
c0102cbc:	6a 7a                	push   $0x7a
  jmp __alltraps
c0102cbe:	e9 2d 06 00 00       	jmp    c01032f0 <__alltraps>

c0102cc3 <vector123>:
.globl vector123
vector123:
  pushl $0
c0102cc3:	6a 00                	push   $0x0
  pushl $123
c0102cc5:	6a 7b                	push   $0x7b
  jmp __alltraps
c0102cc7:	e9 24 06 00 00       	jmp    c01032f0 <__alltraps>

c0102ccc <vector124>:
.globl vector124
vector124:
  pushl $0
c0102ccc:	6a 00                	push   $0x0
  pushl $124
c0102cce:	6a 7c                	push   $0x7c
  jmp __alltraps
c0102cd0:	e9 1b 06 00 00       	jmp    c01032f0 <__alltraps>

c0102cd5 <vector125>:
.globl vector125
vector125:
  pushl $0
c0102cd5:	6a 00                	push   $0x0
  pushl $125
c0102cd7:	6a 7d                	push   $0x7d
  jmp __alltraps
c0102cd9:	e9 12 06 00 00       	jmp    c01032f0 <__alltraps>

c0102cde <vector126>:
.globl vector126
vector126:
  pushl $0
c0102cde:	6a 00                	push   $0x0
  pushl $126
c0102ce0:	6a 7e                	push   $0x7e
  jmp __alltraps
c0102ce2:	e9 09 06 00 00       	jmp    c01032f0 <__alltraps>

c0102ce7 <vector127>:
.globl vector127
vector127:
  pushl $0
c0102ce7:	6a 00                	push   $0x0
  pushl $127
c0102ce9:	6a 7f                	push   $0x7f
  jmp __alltraps
c0102ceb:	e9 00 06 00 00       	jmp    c01032f0 <__alltraps>

c0102cf0 <vector128>:
.globl vector128
vector128:
  pushl $0
c0102cf0:	6a 00                	push   $0x0
  pushl $128
c0102cf2:	68 80 00 00 00       	push   $0x80
  jmp __alltraps
c0102cf7:	e9 f4 05 00 00       	jmp    c01032f0 <__alltraps>

c0102cfc <vector129>:
.globl vector129
vector129:
  pushl $0
c0102cfc:	6a 00                	push   $0x0
  pushl $129
c0102cfe:	68 81 00 00 00       	push   $0x81
  jmp __alltraps
c0102d03:	e9 e8 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d08 <vector130>:
.globl vector130
vector130:
  pushl $0
c0102d08:	6a 00                	push   $0x0
  pushl $130
c0102d0a:	68 82 00 00 00       	push   $0x82
  jmp __alltraps
c0102d0f:	e9 dc 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d14 <vector131>:
.globl vector131
vector131:
  pushl $0
c0102d14:	6a 00                	push   $0x0
  pushl $131
c0102d16:	68 83 00 00 00       	push   $0x83
  jmp __alltraps
c0102d1b:	e9 d0 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d20 <vector132>:
.globl vector132
vector132:
  pushl $0
c0102d20:	6a 00                	push   $0x0
  pushl $132
c0102d22:	68 84 00 00 00       	push   $0x84
  jmp __alltraps
c0102d27:	e9 c4 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d2c <vector133>:
.globl vector133
vector133:
  pushl $0
c0102d2c:	6a 00                	push   $0x0
  pushl $133
c0102d2e:	68 85 00 00 00       	push   $0x85
  jmp __alltraps
c0102d33:	e9 b8 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d38 <vector134>:
.globl vector134
vector134:
  pushl $0
c0102d38:	6a 00                	push   $0x0
  pushl $134
c0102d3a:	68 86 00 00 00       	push   $0x86
  jmp __alltraps
c0102d3f:	e9 ac 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d44 <vector135>:
.globl vector135
vector135:
  pushl $0
c0102d44:	6a 00                	push   $0x0
  pushl $135
c0102d46:	68 87 00 00 00       	push   $0x87
  jmp __alltraps
c0102d4b:	e9 a0 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d50 <vector136>:
.globl vector136
vector136:
  pushl $0
c0102d50:	6a 00                	push   $0x0
  pushl $136
c0102d52:	68 88 00 00 00       	push   $0x88
  jmp __alltraps
c0102d57:	e9 94 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d5c <vector137>:
.globl vector137
vector137:
  pushl $0
c0102d5c:	6a 00                	push   $0x0
  pushl $137
c0102d5e:	68 89 00 00 00       	push   $0x89
  jmp __alltraps
c0102d63:	e9 88 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d68 <vector138>:
.globl vector138
vector138:
  pushl $0
c0102d68:	6a 00                	push   $0x0
  pushl $138
c0102d6a:	68 8a 00 00 00       	push   $0x8a
  jmp __alltraps
c0102d6f:	e9 7c 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d74 <vector139>:
.globl vector139
vector139:
  pushl $0
c0102d74:	6a 00                	push   $0x0
  pushl $139
c0102d76:	68 8b 00 00 00       	push   $0x8b
  jmp __alltraps
c0102d7b:	e9 70 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d80 <vector140>:
.globl vector140
vector140:
  pushl $0
c0102d80:	6a 00                	push   $0x0
  pushl $140
c0102d82:	68 8c 00 00 00       	push   $0x8c
  jmp __alltraps
c0102d87:	e9 64 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d8c <vector141>:
.globl vector141
vector141:
  pushl $0
c0102d8c:	6a 00                	push   $0x0
  pushl $141
c0102d8e:	68 8d 00 00 00       	push   $0x8d
  jmp __alltraps
c0102d93:	e9 58 05 00 00       	jmp    c01032f0 <__alltraps>

c0102d98 <vector142>:
.globl vector142
vector142:
  pushl $0
c0102d98:	6a 00                	push   $0x0
  pushl $142
c0102d9a:	68 8e 00 00 00       	push   $0x8e
  jmp __alltraps
c0102d9f:	e9 4c 05 00 00       	jmp    c01032f0 <__alltraps>

c0102da4 <vector143>:
.globl vector143
vector143:
  pushl $0
c0102da4:	6a 00                	push   $0x0
  pushl $143
c0102da6:	68 8f 00 00 00       	push   $0x8f
  jmp __alltraps
c0102dab:	e9 40 05 00 00       	jmp    c01032f0 <__alltraps>

c0102db0 <vector144>:
.globl vector144
vector144:
  pushl $0
c0102db0:	6a 00                	push   $0x0
  pushl $144
c0102db2:	68 90 00 00 00       	push   $0x90
  jmp __alltraps
c0102db7:	e9 34 05 00 00       	jmp    c01032f0 <__alltraps>

c0102dbc <vector145>:
.globl vector145
vector145:
  pushl $0
c0102dbc:	6a 00                	push   $0x0
  pushl $145
c0102dbe:	68 91 00 00 00       	push   $0x91
  jmp __alltraps
c0102dc3:	e9 28 05 00 00       	jmp    c01032f0 <__alltraps>

c0102dc8 <vector146>:
.globl vector146
vector146:
  pushl $0
c0102dc8:	6a 00                	push   $0x0
  pushl $146
c0102dca:	68 92 00 00 00       	push   $0x92
  jmp __alltraps
c0102dcf:	e9 1c 05 00 00       	jmp    c01032f0 <__alltraps>

c0102dd4 <vector147>:
.globl vector147
vector147:
  pushl $0
c0102dd4:	6a 00                	push   $0x0
  pushl $147
c0102dd6:	68 93 00 00 00       	push   $0x93
  jmp __alltraps
c0102ddb:	e9 10 05 00 00       	jmp    c01032f0 <__alltraps>

c0102de0 <vector148>:
.globl vector148
vector148:
  pushl $0
c0102de0:	6a 00                	push   $0x0
  pushl $148
c0102de2:	68 94 00 00 00       	push   $0x94
  jmp __alltraps
c0102de7:	e9 04 05 00 00       	jmp    c01032f0 <__alltraps>

c0102dec <vector149>:
.globl vector149
vector149:
  pushl $0
c0102dec:	6a 00                	push   $0x0
  pushl $149
c0102dee:	68 95 00 00 00       	push   $0x95
  jmp __alltraps
c0102df3:	e9 f8 04 00 00       	jmp    c01032f0 <__alltraps>

c0102df8 <vector150>:
.globl vector150
vector150:
  pushl $0
c0102df8:	6a 00                	push   $0x0
  pushl $150
c0102dfa:	68 96 00 00 00       	push   $0x96
  jmp __alltraps
c0102dff:	e9 ec 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e04 <vector151>:
.globl vector151
vector151:
  pushl $0
c0102e04:	6a 00                	push   $0x0
  pushl $151
c0102e06:	68 97 00 00 00       	push   $0x97
  jmp __alltraps
c0102e0b:	e9 e0 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e10 <vector152>:
.globl vector152
vector152:
  pushl $0
c0102e10:	6a 00                	push   $0x0
  pushl $152
c0102e12:	68 98 00 00 00       	push   $0x98
  jmp __alltraps
c0102e17:	e9 d4 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e1c <vector153>:
.globl vector153
vector153:
  pushl $0
c0102e1c:	6a 00                	push   $0x0
  pushl $153
c0102e1e:	68 99 00 00 00       	push   $0x99
  jmp __alltraps
c0102e23:	e9 c8 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e28 <vector154>:
.globl vector154
vector154:
  pushl $0
c0102e28:	6a 00                	push   $0x0
  pushl $154
c0102e2a:	68 9a 00 00 00       	push   $0x9a
  jmp __alltraps
c0102e2f:	e9 bc 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e34 <vector155>:
.globl vector155
vector155:
  pushl $0
c0102e34:	6a 00                	push   $0x0
  pushl $155
c0102e36:	68 9b 00 00 00       	push   $0x9b
  jmp __alltraps
c0102e3b:	e9 b0 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e40 <vector156>:
.globl vector156
vector156:
  pushl $0
c0102e40:	6a 00                	push   $0x0
  pushl $156
c0102e42:	68 9c 00 00 00       	push   $0x9c
  jmp __alltraps
c0102e47:	e9 a4 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e4c <vector157>:
.globl vector157
vector157:
  pushl $0
c0102e4c:	6a 00                	push   $0x0
  pushl $157
c0102e4e:	68 9d 00 00 00       	push   $0x9d
  jmp __alltraps
c0102e53:	e9 98 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e58 <vector158>:
.globl vector158
vector158:
  pushl $0
c0102e58:	6a 00                	push   $0x0
  pushl $158
c0102e5a:	68 9e 00 00 00       	push   $0x9e
  jmp __alltraps
c0102e5f:	e9 8c 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e64 <vector159>:
.globl vector159
vector159:
  pushl $0
c0102e64:	6a 00                	push   $0x0
  pushl $159
c0102e66:	68 9f 00 00 00       	push   $0x9f
  jmp __alltraps
c0102e6b:	e9 80 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e70 <vector160>:
.globl vector160
vector160:
  pushl $0
c0102e70:	6a 00                	push   $0x0
  pushl $160
c0102e72:	68 a0 00 00 00       	push   $0xa0
  jmp __alltraps
c0102e77:	e9 74 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e7c <vector161>:
.globl vector161
vector161:
  pushl $0
c0102e7c:	6a 00                	push   $0x0
  pushl $161
c0102e7e:	68 a1 00 00 00       	push   $0xa1
  jmp __alltraps
c0102e83:	e9 68 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e88 <vector162>:
.globl vector162
vector162:
  pushl $0
c0102e88:	6a 00                	push   $0x0
  pushl $162
c0102e8a:	68 a2 00 00 00       	push   $0xa2
  jmp __alltraps
c0102e8f:	e9 5c 04 00 00       	jmp    c01032f0 <__alltraps>

c0102e94 <vector163>:
.globl vector163
vector163:
  pushl $0
c0102e94:	6a 00                	push   $0x0
  pushl $163
c0102e96:	68 a3 00 00 00       	push   $0xa3
  jmp __alltraps
c0102e9b:	e9 50 04 00 00       	jmp    c01032f0 <__alltraps>

c0102ea0 <vector164>:
.globl vector164
vector164:
  pushl $0
c0102ea0:	6a 00                	push   $0x0
  pushl $164
c0102ea2:	68 a4 00 00 00       	push   $0xa4
  jmp __alltraps
c0102ea7:	e9 44 04 00 00       	jmp    c01032f0 <__alltraps>

c0102eac <vector165>:
.globl vector165
vector165:
  pushl $0
c0102eac:	6a 00                	push   $0x0
  pushl $165
c0102eae:	68 a5 00 00 00       	push   $0xa5
  jmp __alltraps
c0102eb3:	e9 38 04 00 00       	jmp    c01032f0 <__alltraps>

c0102eb8 <vector166>:
.globl vector166
vector166:
  pushl $0
c0102eb8:	6a 00                	push   $0x0
  pushl $166
c0102eba:	68 a6 00 00 00       	push   $0xa6
  jmp __alltraps
c0102ebf:	e9 2c 04 00 00       	jmp    c01032f0 <__alltraps>

c0102ec4 <vector167>:
.globl vector167
vector167:
  pushl $0
c0102ec4:	6a 00                	push   $0x0
  pushl $167
c0102ec6:	68 a7 00 00 00       	push   $0xa7
  jmp __alltraps
c0102ecb:	e9 20 04 00 00       	jmp    c01032f0 <__alltraps>

c0102ed0 <vector168>:
.globl vector168
vector168:
  pushl $0
c0102ed0:	6a 00                	push   $0x0
  pushl $168
c0102ed2:	68 a8 00 00 00       	push   $0xa8
  jmp __alltraps
c0102ed7:	e9 14 04 00 00       	jmp    c01032f0 <__alltraps>

c0102edc <vector169>:
.globl vector169
vector169:
  pushl $0
c0102edc:	6a 00                	push   $0x0
  pushl $169
c0102ede:	68 a9 00 00 00       	push   $0xa9
  jmp __alltraps
c0102ee3:	e9 08 04 00 00       	jmp    c01032f0 <__alltraps>

c0102ee8 <vector170>:
.globl vector170
vector170:
  pushl $0
c0102ee8:	6a 00                	push   $0x0
  pushl $170
c0102eea:	68 aa 00 00 00       	push   $0xaa
  jmp __alltraps
c0102eef:	e9 fc 03 00 00       	jmp    c01032f0 <__alltraps>

c0102ef4 <vector171>:
.globl vector171
vector171:
  pushl $0
c0102ef4:	6a 00                	push   $0x0
  pushl $171
c0102ef6:	68 ab 00 00 00       	push   $0xab
  jmp __alltraps
c0102efb:	e9 f0 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f00 <vector172>:
.globl vector172
vector172:
  pushl $0
c0102f00:	6a 00                	push   $0x0
  pushl $172
c0102f02:	68 ac 00 00 00       	push   $0xac
  jmp __alltraps
c0102f07:	e9 e4 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f0c <vector173>:
.globl vector173
vector173:
  pushl $0
c0102f0c:	6a 00                	push   $0x0
  pushl $173
c0102f0e:	68 ad 00 00 00       	push   $0xad
  jmp __alltraps
c0102f13:	e9 d8 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f18 <vector174>:
.globl vector174
vector174:
  pushl $0
c0102f18:	6a 00                	push   $0x0
  pushl $174
c0102f1a:	68 ae 00 00 00       	push   $0xae
  jmp __alltraps
c0102f1f:	e9 cc 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f24 <vector175>:
.globl vector175
vector175:
  pushl $0
c0102f24:	6a 00                	push   $0x0
  pushl $175
c0102f26:	68 af 00 00 00       	push   $0xaf
  jmp __alltraps
c0102f2b:	e9 c0 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f30 <vector176>:
.globl vector176
vector176:
  pushl $0
c0102f30:	6a 00                	push   $0x0
  pushl $176
c0102f32:	68 b0 00 00 00       	push   $0xb0
  jmp __alltraps
c0102f37:	e9 b4 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f3c <vector177>:
.globl vector177
vector177:
  pushl $0
c0102f3c:	6a 00                	push   $0x0
  pushl $177
c0102f3e:	68 b1 00 00 00       	push   $0xb1
  jmp __alltraps
c0102f43:	e9 a8 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f48 <vector178>:
.globl vector178
vector178:
  pushl $0
c0102f48:	6a 00                	push   $0x0
  pushl $178
c0102f4a:	68 b2 00 00 00       	push   $0xb2
  jmp __alltraps
c0102f4f:	e9 9c 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f54 <vector179>:
.globl vector179
vector179:
  pushl $0
c0102f54:	6a 00                	push   $0x0
  pushl $179
c0102f56:	68 b3 00 00 00       	push   $0xb3
  jmp __alltraps
c0102f5b:	e9 90 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f60 <vector180>:
.globl vector180
vector180:
  pushl $0
c0102f60:	6a 00                	push   $0x0
  pushl $180
c0102f62:	68 b4 00 00 00       	push   $0xb4
  jmp __alltraps
c0102f67:	e9 84 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f6c <vector181>:
.globl vector181
vector181:
  pushl $0
c0102f6c:	6a 00                	push   $0x0
  pushl $181
c0102f6e:	68 b5 00 00 00       	push   $0xb5
  jmp __alltraps
c0102f73:	e9 78 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f78 <vector182>:
.globl vector182
vector182:
  pushl $0
c0102f78:	6a 00                	push   $0x0
  pushl $182
c0102f7a:	68 b6 00 00 00       	push   $0xb6
  jmp __alltraps
c0102f7f:	e9 6c 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f84 <vector183>:
.globl vector183
vector183:
  pushl $0
c0102f84:	6a 00                	push   $0x0
  pushl $183
c0102f86:	68 b7 00 00 00       	push   $0xb7
  jmp __alltraps
c0102f8b:	e9 60 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f90 <vector184>:
.globl vector184
vector184:
  pushl $0
c0102f90:	6a 00                	push   $0x0
  pushl $184
c0102f92:	68 b8 00 00 00       	push   $0xb8
  jmp __alltraps
c0102f97:	e9 54 03 00 00       	jmp    c01032f0 <__alltraps>

c0102f9c <vector185>:
.globl vector185
vector185:
  pushl $0
c0102f9c:	6a 00                	push   $0x0
  pushl $185
c0102f9e:	68 b9 00 00 00       	push   $0xb9
  jmp __alltraps
c0102fa3:	e9 48 03 00 00       	jmp    c01032f0 <__alltraps>

c0102fa8 <vector186>:
.globl vector186
vector186:
  pushl $0
c0102fa8:	6a 00                	push   $0x0
  pushl $186
c0102faa:	68 ba 00 00 00       	push   $0xba
  jmp __alltraps
c0102faf:	e9 3c 03 00 00       	jmp    c01032f0 <__alltraps>

c0102fb4 <vector187>:
.globl vector187
vector187:
  pushl $0
c0102fb4:	6a 00                	push   $0x0
  pushl $187
c0102fb6:	68 bb 00 00 00       	push   $0xbb
  jmp __alltraps
c0102fbb:	e9 30 03 00 00       	jmp    c01032f0 <__alltraps>

c0102fc0 <vector188>:
.globl vector188
vector188:
  pushl $0
c0102fc0:	6a 00                	push   $0x0
  pushl $188
c0102fc2:	68 bc 00 00 00       	push   $0xbc
  jmp __alltraps
c0102fc7:	e9 24 03 00 00       	jmp    c01032f0 <__alltraps>

c0102fcc <vector189>:
.globl vector189
vector189:
  pushl $0
c0102fcc:	6a 00                	push   $0x0
  pushl $189
c0102fce:	68 bd 00 00 00       	push   $0xbd
  jmp __alltraps
c0102fd3:	e9 18 03 00 00       	jmp    c01032f0 <__alltraps>

c0102fd8 <vector190>:
.globl vector190
vector190:
  pushl $0
c0102fd8:	6a 00                	push   $0x0
  pushl $190
c0102fda:	68 be 00 00 00       	push   $0xbe
  jmp __alltraps
c0102fdf:	e9 0c 03 00 00       	jmp    c01032f0 <__alltraps>

c0102fe4 <vector191>:
.globl vector191
vector191:
  pushl $0
c0102fe4:	6a 00                	push   $0x0
  pushl $191
c0102fe6:	68 bf 00 00 00       	push   $0xbf
  jmp __alltraps
c0102feb:	e9 00 03 00 00       	jmp    c01032f0 <__alltraps>

c0102ff0 <vector192>:
.globl vector192
vector192:
  pushl $0
c0102ff0:	6a 00                	push   $0x0
  pushl $192
c0102ff2:	68 c0 00 00 00       	push   $0xc0
  jmp __alltraps
c0102ff7:	e9 f4 02 00 00       	jmp    c01032f0 <__alltraps>

c0102ffc <vector193>:
.globl vector193
vector193:
  pushl $0
c0102ffc:	6a 00                	push   $0x0
  pushl $193
c0102ffe:	68 c1 00 00 00       	push   $0xc1
  jmp __alltraps
c0103003:	e9 e8 02 00 00       	jmp    c01032f0 <__alltraps>

c0103008 <vector194>:
.globl vector194
vector194:
  pushl $0
c0103008:	6a 00                	push   $0x0
  pushl $194
c010300a:	68 c2 00 00 00       	push   $0xc2
  jmp __alltraps
c010300f:	e9 dc 02 00 00       	jmp    c01032f0 <__alltraps>

c0103014 <vector195>:
.globl vector195
vector195:
  pushl $0
c0103014:	6a 00                	push   $0x0
  pushl $195
c0103016:	68 c3 00 00 00       	push   $0xc3
  jmp __alltraps
c010301b:	e9 d0 02 00 00       	jmp    c01032f0 <__alltraps>

c0103020 <vector196>:
.globl vector196
vector196:
  pushl $0
c0103020:	6a 00                	push   $0x0
  pushl $196
c0103022:	68 c4 00 00 00       	push   $0xc4
  jmp __alltraps
c0103027:	e9 c4 02 00 00       	jmp    c01032f0 <__alltraps>

c010302c <vector197>:
.globl vector197
vector197:
  pushl $0
c010302c:	6a 00                	push   $0x0
  pushl $197
c010302e:	68 c5 00 00 00       	push   $0xc5
  jmp __alltraps
c0103033:	e9 b8 02 00 00       	jmp    c01032f0 <__alltraps>

c0103038 <vector198>:
.globl vector198
vector198:
  pushl $0
c0103038:	6a 00                	push   $0x0
  pushl $198
c010303a:	68 c6 00 00 00       	push   $0xc6
  jmp __alltraps
c010303f:	e9 ac 02 00 00       	jmp    c01032f0 <__alltraps>

c0103044 <vector199>:
.globl vector199
vector199:
  pushl $0
c0103044:	6a 00                	push   $0x0
  pushl $199
c0103046:	68 c7 00 00 00       	push   $0xc7
  jmp __alltraps
c010304b:	e9 a0 02 00 00       	jmp    c01032f0 <__alltraps>

c0103050 <vector200>:
.globl vector200
vector200:
  pushl $0
c0103050:	6a 00                	push   $0x0
  pushl $200
c0103052:	68 c8 00 00 00       	push   $0xc8
  jmp __alltraps
c0103057:	e9 94 02 00 00       	jmp    c01032f0 <__alltraps>

c010305c <vector201>:
.globl vector201
vector201:
  pushl $0
c010305c:	6a 00                	push   $0x0
  pushl $201
c010305e:	68 c9 00 00 00       	push   $0xc9
  jmp __alltraps
c0103063:	e9 88 02 00 00       	jmp    c01032f0 <__alltraps>

c0103068 <vector202>:
.globl vector202
vector202:
  pushl $0
c0103068:	6a 00                	push   $0x0
  pushl $202
c010306a:	68 ca 00 00 00       	push   $0xca
  jmp __alltraps
c010306f:	e9 7c 02 00 00       	jmp    c01032f0 <__alltraps>

c0103074 <vector203>:
.globl vector203
vector203:
  pushl $0
c0103074:	6a 00                	push   $0x0
  pushl $203
c0103076:	68 cb 00 00 00       	push   $0xcb
  jmp __alltraps
c010307b:	e9 70 02 00 00       	jmp    c01032f0 <__alltraps>

c0103080 <vector204>:
.globl vector204
vector204:
  pushl $0
c0103080:	6a 00                	push   $0x0
  pushl $204
c0103082:	68 cc 00 00 00       	push   $0xcc
  jmp __alltraps
c0103087:	e9 64 02 00 00       	jmp    c01032f0 <__alltraps>

c010308c <vector205>:
.globl vector205
vector205:
  pushl $0
c010308c:	6a 00                	push   $0x0
  pushl $205
c010308e:	68 cd 00 00 00       	push   $0xcd
  jmp __alltraps
c0103093:	e9 58 02 00 00       	jmp    c01032f0 <__alltraps>

c0103098 <vector206>:
.globl vector206
vector206:
  pushl $0
c0103098:	6a 00                	push   $0x0
  pushl $206
c010309a:	68 ce 00 00 00       	push   $0xce
  jmp __alltraps
c010309f:	e9 4c 02 00 00       	jmp    c01032f0 <__alltraps>

c01030a4 <vector207>:
.globl vector207
vector207:
  pushl $0
c01030a4:	6a 00                	push   $0x0
  pushl $207
c01030a6:	68 cf 00 00 00       	push   $0xcf
  jmp __alltraps
c01030ab:	e9 40 02 00 00       	jmp    c01032f0 <__alltraps>

c01030b0 <vector208>:
.globl vector208
vector208:
  pushl $0
c01030b0:	6a 00                	push   $0x0
  pushl $208
c01030b2:	68 d0 00 00 00       	push   $0xd0
  jmp __alltraps
c01030b7:	e9 34 02 00 00       	jmp    c01032f0 <__alltraps>

c01030bc <vector209>:
.globl vector209
vector209:
  pushl $0
c01030bc:	6a 00                	push   $0x0
  pushl $209
c01030be:	68 d1 00 00 00       	push   $0xd1
  jmp __alltraps
c01030c3:	e9 28 02 00 00       	jmp    c01032f0 <__alltraps>

c01030c8 <vector210>:
.globl vector210
vector210:
  pushl $0
c01030c8:	6a 00                	push   $0x0
  pushl $210
c01030ca:	68 d2 00 00 00       	push   $0xd2
  jmp __alltraps
c01030cf:	e9 1c 02 00 00       	jmp    c01032f0 <__alltraps>

c01030d4 <vector211>:
.globl vector211
vector211:
  pushl $0
c01030d4:	6a 00                	push   $0x0
  pushl $211
c01030d6:	68 d3 00 00 00       	push   $0xd3
  jmp __alltraps
c01030db:	e9 10 02 00 00       	jmp    c01032f0 <__alltraps>

c01030e0 <vector212>:
.globl vector212
vector212:
  pushl $0
c01030e0:	6a 00                	push   $0x0
  pushl $212
c01030e2:	68 d4 00 00 00       	push   $0xd4
  jmp __alltraps
c01030e7:	e9 04 02 00 00       	jmp    c01032f0 <__alltraps>

c01030ec <vector213>:
.globl vector213
vector213:
  pushl $0
c01030ec:	6a 00                	push   $0x0
  pushl $213
c01030ee:	68 d5 00 00 00       	push   $0xd5
  jmp __alltraps
c01030f3:	e9 f8 01 00 00       	jmp    c01032f0 <__alltraps>

c01030f8 <vector214>:
.globl vector214
vector214:
  pushl $0
c01030f8:	6a 00                	push   $0x0
  pushl $214
c01030fa:	68 d6 00 00 00       	push   $0xd6
  jmp __alltraps
c01030ff:	e9 ec 01 00 00       	jmp    c01032f0 <__alltraps>

c0103104 <vector215>:
.globl vector215
vector215:
  pushl $0
c0103104:	6a 00                	push   $0x0
  pushl $215
c0103106:	68 d7 00 00 00       	push   $0xd7
  jmp __alltraps
c010310b:	e9 e0 01 00 00       	jmp    c01032f0 <__alltraps>

c0103110 <vector216>:
.globl vector216
vector216:
  pushl $0
c0103110:	6a 00                	push   $0x0
  pushl $216
c0103112:	68 d8 00 00 00       	push   $0xd8
  jmp __alltraps
c0103117:	e9 d4 01 00 00       	jmp    c01032f0 <__alltraps>

c010311c <vector217>:
.globl vector217
vector217:
  pushl $0
c010311c:	6a 00                	push   $0x0
  pushl $217
c010311e:	68 d9 00 00 00       	push   $0xd9
  jmp __alltraps
c0103123:	e9 c8 01 00 00       	jmp    c01032f0 <__alltraps>

c0103128 <vector218>:
.globl vector218
vector218:
  pushl $0
c0103128:	6a 00                	push   $0x0
  pushl $218
c010312a:	68 da 00 00 00       	push   $0xda
  jmp __alltraps
c010312f:	e9 bc 01 00 00       	jmp    c01032f0 <__alltraps>

c0103134 <vector219>:
.globl vector219
vector219:
  pushl $0
c0103134:	6a 00                	push   $0x0
  pushl $219
c0103136:	68 db 00 00 00       	push   $0xdb
  jmp __alltraps
c010313b:	e9 b0 01 00 00       	jmp    c01032f0 <__alltraps>

c0103140 <vector220>:
.globl vector220
vector220:
  pushl $0
c0103140:	6a 00                	push   $0x0
  pushl $220
c0103142:	68 dc 00 00 00       	push   $0xdc
  jmp __alltraps
c0103147:	e9 a4 01 00 00       	jmp    c01032f0 <__alltraps>

c010314c <vector221>:
.globl vector221
vector221:
  pushl $0
c010314c:	6a 00                	push   $0x0
  pushl $221
c010314e:	68 dd 00 00 00       	push   $0xdd
  jmp __alltraps
c0103153:	e9 98 01 00 00       	jmp    c01032f0 <__alltraps>

c0103158 <vector222>:
.globl vector222
vector222:
  pushl $0
c0103158:	6a 00                	push   $0x0
  pushl $222
c010315a:	68 de 00 00 00       	push   $0xde
  jmp __alltraps
c010315f:	e9 8c 01 00 00       	jmp    c01032f0 <__alltraps>

c0103164 <vector223>:
.globl vector223
vector223:
  pushl $0
c0103164:	6a 00                	push   $0x0
  pushl $223
c0103166:	68 df 00 00 00       	push   $0xdf
  jmp __alltraps
c010316b:	e9 80 01 00 00       	jmp    c01032f0 <__alltraps>

c0103170 <vector224>:
.globl vector224
vector224:
  pushl $0
c0103170:	6a 00                	push   $0x0
  pushl $224
c0103172:	68 e0 00 00 00       	push   $0xe0
  jmp __alltraps
c0103177:	e9 74 01 00 00       	jmp    c01032f0 <__alltraps>

c010317c <vector225>:
.globl vector225
vector225:
  pushl $0
c010317c:	6a 00                	push   $0x0
  pushl $225
c010317e:	68 e1 00 00 00       	push   $0xe1
  jmp __alltraps
c0103183:	e9 68 01 00 00       	jmp    c01032f0 <__alltraps>

c0103188 <vector226>:
.globl vector226
vector226:
  pushl $0
c0103188:	6a 00                	push   $0x0
  pushl $226
c010318a:	68 e2 00 00 00       	push   $0xe2
  jmp __alltraps
c010318f:	e9 5c 01 00 00       	jmp    c01032f0 <__alltraps>

c0103194 <vector227>:
.globl vector227
vector227:
  pushl $0
c0103194:	6a 00                	push   $0x0
  pushl $227
c0103196:	68 e3 00 00 00       	push   $0xe3
  jmp __alltraps
c010319b:	e9 50 01 00 00       	jmp    c01032f0 <__alltraps>

c01031a0 <vector228>:
.globl vector228
vector228:
  pushl $0
c01031a0:	6a 00                	push   $0x0
  pushl $228
c01031a2:	68 e4 00 00 00       	push   $0xe4
  jmp __alltraps
c01031a7:	e9 44 01 00 00       	jmp    c01032f0 <__alltraps>

c01031ac <vector229>:
.globl vector229
vector229:
  pushl $0
c01031ac:	6a 00                	push   $0x0
  pushl $229
c01031ae:	68 e5 00 00 00       	push   $0xe5
  jmp __alltraps
c01031b3:	e9 38 01 00 00       	jmp    c01032f0 <__alltraps>

c01031b8 <vector230>:
.globl vector230
vector230:
  pushl $0
c01031b8:	6a 00                	push   $0x0
  pushl $230
c01031ba:	68 e6 00 00 00       	push   $0xe6
  jmp __alltraps
c01031bf:	e9 2c 01 00 00       	jmp    c01032f0 <__alltraps>

c01031c4 <vector231>:
.globl vector231
vector231:
  pushl $0
c01031c4:	6a 00                	push   $0x0
  pushl $231
c01031c6:	68 e7 00 00 00       	push   $0xe7
  jmp __alltraps
c01031cb:	e9 20 01 00 00       	jmp    c01032f0 <__alltraps>

c01031d0 <vector232>:
.globl vector232
vector232:
  pushl $0
c01031d0:	6a 00                	push   $0x0
  pushl $232
c01031d2:	68 e8 00 00 00       	push   $0xe8
  jmp __alltraps
c01031d7:	e9 14 01 00 00       	jmp    c01032f0 <__alltraps>

c01031dc <vector233>:
.globl vector233
vector233:
  pushl $0
c01031dc:	6a 00                	push   $0x0
  pushl $233
c01031de:	68 e9 00 00 00       	push   $0xe9
  jmp __alltraps
c01031e3:	e9 08 01 00 00       	jmp    c01032f0 <__alltraps>

c01031e8 <vector234>:
.globl vector234
vector234:
  pushl $0
c01031e8:	6a 00                	push   $0x0
  pushl $234
c01031ea:	68 ea 00 00 00       	push   $0xea
  jmp __alltraps
c01031ef:	e9 fc 00 00 00       	jmp    c01032f0 <__alltraps>

c01031f4 <vector235>:
.globl vector235
vector235:
  pushl $0
c01031f4:	6a 00                	push   $0x0
  pushl $235
c01031f6:	68 eb 00 00 00       	push   $0xeb
  jmp __alltraps
c01031fb:	e9 f0 00 00 00       	jmp    c01032f0 <__alltraps>

c0103200 <vector236>:
.globl vector236
vector236:
  pushl $0
c0103200:	6a 00                	push   $0x0
  pushl $236
c0103202:	68 ec 00 00 00       	push   $0xec
  jmp __alltraps
c0103207:	e9 e4 00 00 00       	jmp    c01032f0 <__alltraps>

c010320c <vector237>:
.globl vector237
vector237:
  pushl $0
c010320c:	6a 00                	push   $0x0
  pushl $237
c010320e:	68 ed 00 00 00       	push   $0xed
  jmp __alltraps
c0103213:	e9 d8 00 00 00       	jmp    c01032f0 <__alltraps>

c0103218 <vector238>:
.globl vector238
vector238:
  pushl $0
c0103218:	6a 00                	push   $0x0
  pushl $238
c010321a:	68 ee 00 00 00       	push   $0xee
  jmp __alltraps
c010321f:	e9 cc 00 00 00       	jmp    c01032f0 <__alltraps>

c0103224 <vector239>:
.globl vector239
vector239:
  pushl $0
c0103224:	6a 00                	push   $0x0
  pushl $239
c0103226:	68 ef 00 00 00       	push   $0xef
  jmp __alltraps
c010322b:	e9 c0 00 00 00       	jmp    c01032f0 <__alltraps>

c0103230 <vector240>:
.globl vector240
vector240:
  pushl $0
c0103230:	6a 00                	push   $0x0
  pushl $240
c0103232:	68 f0 00 00 00       	push   $0xf0
  jmp __alltraps
c0103237:	e9 b4 00 00 00       	jmp    c01032f0 <__alltraps>

c010323c <vector241>:
.globl vector241
vector241:
  pushl $0
c010323c:	6a 00                	push   $0x0
  pushl $241
c010323e:	68 f1 00 00 00       	push   $0xf1
  jmp __alltraps
c0103243:	e9 a8 00 00 00       	jmp    c01032f0 <__alltraps>

c0103248 <vector242>:
.globl vector242
vector242:
  pushl $0
c0103248:	6a 00                	push   $0x0
  pushl $242
c010324a:	68 f2 00 00 00       	push   $0xf2
  jmp __alltraps
c010324f:	e9 9c 00 00 00       	jmp    c01032f0 <__alltraps>

c0103254 <vector243>:
.globl vector243
vector243:
  pushl $0
c0103254:	6a 00                	push   $0x0
  pushl $243
c0103256:	68 f3 00 00 00       	push   $0xf3
  jmp __alltraps
c010325b:	e9 90 00 00 00       	jmp    c01032f0 <__alltraps>

c0103260 <vector244>:
.globl vector244
vector244:
  pushl $0
c0103260:	6a 00                	push   $0x0
  pushl $244
c0103262:	68 f4 00 00 00       	push   $0xf4
  jmp __alltraps
c0103267:	e9 84 00 00 00       	jmp    c01032f0 <__alltraps>

c010326c <vector245>:
.globl vector245
vector245:
  pushl $0
c010326c:	6a 00                	push   $0x0
  pushl $245
c010326e:	68 f5 00 00 00       	push   $0xf5
  jmp __alltraps
c0103273:	e9 78 00 00 00       	jmp    c01032f0 <__alltraps>

c0103278 <vector246>:
.globl vector246
vector246:
  pushl $0
c0103278:	6a 00                	push   $0x0
  pushl $246
c010327a:	68 f6 00 00 00       	push   $0xf6
  jmp __alltraps
c010327f:	e9 6c 00 00 00       	jmp    c01032f0 <__alltraps>

c0103284 <vector247>:
.globl vector247
vector247:
  pushl $0
c0103284:	6a 00                	push   $0x0
  pushl $247
c0103286:	68 f7 00 00 00       	push   $0xf7
  jmp __alltraps
c010328b:	e9 60 00 00 00       	jmp    c01032f0 <__alltraps>

c0103290 <vector248>:
.globl vector248
vector248:
  pushl $0
c0103290:	6a 00                	push   $0x0
  pushl $248
c0103292:	68 f8 00 00 00       	push   $0xf8
  jmp __alltraps
c0103297:	e9 54 00 00 00       	jmp    c01032f0 <__alltraps>

c010329c <vector249>:
.globl vector249
vector249:
  pushl $0
c010329c:	6a 00                	push   $0x0
  pushl $249
c010329e:	68 f9 00 00 00       	push   $0xf9
  jmp __alltraps
c01032a3:	e9 48 00 00 00       	jmp    c01032f0 <__alltraps>

c01032a8 <vector250>:
.globl vector250
vector250:
  pushl $0
c01032a8:	6a 00                	push   $0x0
  pushl $250
c01032aa:	68 fa 00 00 00       	push   $0xfa
  jmp __alltraps
c01032af:	e9 3c 00 00 00       	jmp    c01032f0 <__alltraps>

c01032b4 <vector251>:
.globl vector251
vector251:
  pushl $0
c01032b4:	6a 00                	push   $0x0
  pushl $251
c01032b6:	68 fb 00 00 00       	push   $0xfb
  jmp __alltraps
c01032bb:	e9 30 00 00 00       	jmp    c01032f0 <__alltraps>

c01032c0 <vector252>:
.globl vector252
vector252:
  pushl $0
c01032c0:	6a 00                	push   $0x0
  pushl $252
c01032c2:	68 fc 00 00 00       	push   $0xfc
  jmp __alltraps
c01032c7:	e9 24 00 00 00       	jmp    c01032f0 <__alltraps>

c01032cc <vector253>:
.globl vector253
vector253:
  pushl $0
c01032cc:	6a 00                	push   $0x0
  pushl $253
c01032ce:	68 fd 00 00 00       	push   $0xfd
  jmp __alltraps
c01032d3:	e9 18 00 00 00       	jmp    c01032f0 <__alltraps>

c01032d8 <vector254>:
.globl vector254
vector254:
  pushl $0
c01032d8:	6a 00                	push   $0x0
  pushl $254
c01032da:	68 fe 00 00 00       	push   $0xfe
  jmp __alltraps
c01032df:	e9 0c 00 00 00       	jmp    c01032f0 <__alltraps>

c01032e4 <vector255>:
.globl vector255
vector255:
  pushl $0
c01032e4:	6a 00                	push   $0x0
  pushl $255
c01032e6:	68 ff 00 00 00       	push   $0xff
  jmp __alltraps
c01032eb:	e9 00 00 00 00       	jmp    c01032f0 <__alltraps>

c01032f0 <__alltraps>:
.text
.globl __alltraps
__alltraps:
    # push registers to build a trap frame
    # therefore make the stack look like a struct trapframe
    pushl %ds
c01032f0:	1e                   	push   %ds
    pushl %es
c01032f1:	06                   	push   %es
    pushl %fs
c01032f2:	0f a0                	push   %fs
    pushl %gs
c01032f4:	0f a8                	push   %gs
    pushal
c01032f6:	60                   	pusha  

    # load GD_KDATA into %ds and %es to set up data segments for kernel
    movl $GD_KDATA, %eax
c01032f7:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c01032fc:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c01032fe:	8e c0                	mov    %eax,%es

    # push %esp to pass a pointer to the trapframe as an argument to trap()
    pushl %esp
c0103300:	54                   	push   %esp

    # call trap(tf), where tf=%esp
    call trap
c0103301:	e8 60 f5 ff ff       	call   c0102866 <trap>

    # pop the pushed stack pointer
    popl %esp
c0103306:	5c                   	pop    %esp

c0103307 <__trapret>:

    # return falls through to trapret...
.globl __trapret
__trapret:
    # restore registers from stack
    popal
c0103307:	61                   	popa   

    # restore %ds, %es, %fs and %gs
    popl %gs
c0103308:	0f a9                	pop    %gs
    popl %fs
c010330a:	0f a1                	pop    %fs
    popl %es
c010330c:	07                   	pop    %es
    popl %ds
c010330d:	1f                   	pop    %ds

    # get rid of the trap number and error code
    addl $0x8, %esp
c010330e:	83 c4 08             	add    $0x8,%esp
    iret
c0103311:	cf                   	iret   

c0103312 <forkrets>:

.globl forkrets
forkrets:
    # set stack to this new process's trapframe
    movl 4(%esp), %esp
c0103312:	8b 64 24 04          	mov    0x4(%esp),%esp
    jmp __trapret
c0103316:	eb ef                	jmp    c0103307 <__trapret>

c0103318 <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c0103318:	55                   	push   %ebp
c0103319:	89 e5                	mov    %esp,%ebp
    return page - pages;
c010331b:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c0103320:	8b 55 08             	mov    0x8(%ebp),%edx
c0103323:	29 c2                	sub    %eax,%edx
c0103325:	89 d0                	mov    %edx,%eax
c0103327:	c1 f8 05             	sar    $0x5,%eax
}
c010332a:	5d                   	pop    %ebp
c010332b:	c3                   	ret    

c010332c <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c010332c:	55                   	push   %ebp
c010332d:	89 e5                	mov    %esp,%ebp
c010332f:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0103332:	8b 45 08             	mov    0x8(%ebp),%eax
c0103335:	89 04 24             	mov    %eax,(%esp)
c0103338:	e8 db ff ff ff       	call   c0103318 <page2ppn>
c010333d:	c1 e0 0c             	shl    $0xc,%eax
}
c0103340:	c9                   	leave  
c0103341:	c3                   	ret    

c0103342 <pa2page>:

static inline struct Page *
pa2page(uintptr_t pa) {
c0103342:	55                   	push   %ebp
c0103343:	89 e5                	mov    %esp,%ebp
c0103345:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0103348:	8b 45 08             	mov    0x8(%ebp),%eax
c010334b:	c1 e8 0c             	shr    $0xc,%eax
c010334e:	89 c2                	mov    %eax,%edx
c0103350:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0103355:	39 c2                	cmp    %eax,%edx
c0103357:	72 1c                	jb     c0103375 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0103359:	c7 44 24 08 b0 a9 10 	movl   $0xc010a9b0,0x8(%esp)
c0103360:	c0 
c0103361:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0103368:	00 
c0103369:	c7 04 24 cf a9 10 c0 	movl   $0xc010a9cf,(%esp)
c0103370:	e8 c8 d0 ff ff       	call   c010043d <__panic>
    }
    return &pages[PPN(pa)];
c0103375:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c010337a:	8b 55 08             	mov    0x8(%ebp),%edx
c010337d:	c1 ea 0c             	shr    $0xc,%edx
c0103380:	c1 e2 05             	shl    $0x5,%edx
c0103383:	01 d0                	add    %edx,%eax
}
c0103385:	c9                   	leave  
c0103386:	c3                   	ret    

c0103387 <page2kva>:

static inline void *
page2kva(struct Page *page) {
c0103387:	55                   	push   %ebp
c0103388:	89 e5                	mov    %esp,%ebp
c010338a:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c010338d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103390:	89 04 24             	mov    %eax,(%esp)
c0103393:	e8 94 ff ff ff       	call   c010332c <page2pa>
c0103398:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010339b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010339e:	c1 e8 0c             	shr    $0xc,%eax
c01033a1:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01033a4:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c01033a9:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01033ac:	72 23                	jb     c01033d1 <page2kva+0x4a>
c01033ae:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01033b1:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01033b5:	c7 44 24 08 e0 a9 10 	movl   $0xc010a9e0,0x8(%esp)
c01033bc:	c0 
c01033bd:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c01033c4:	00 
c01033c5:	c7 04 24 cf a9 10 c0 	movl   $0xc010a9cf,(%esp)
c01033cc:	e8 6c d0 ff ff       	call   c010043d <__panic>
c01033d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01033d4:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c01033d9:	c9                   	leave  
c01033da:	c3                   	ret    

c01033db <pte2page>:
kva2page(void *kva) {
    return pa2page(PADDR(kva));
}

static inline struct Page *
pte2page(pte_t pte) {
c01033db:	55                   	push   %ebp
c01033dc:	89 e5                	mov    %esp,%ebp
c01033de:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c01033e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01033e4:	83 e0 01             	and    $0x1,%eax
c01033e7:	85 c0                	test   %eax,%eax
c01033e9:	75 1c                	jne    c0103407 <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c01033eb:	c7 44 24 08 04 aa 10 	movl   $0xc010aa04,0x8(%esp)
c01033f2:	c0 
c01033f3:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c01033fa:	00 
c01033fb:	c7 04 24 cf a9 10 c0 	movl   $0xc010a9cf,(%esp)
c0103402:	e8 36 d0 ff ff       	call   c010043d <__panic>
    }
    return pa2page(PTE_ADDR(pte));
c0103407:	8b 45 08             	mov    0x8(%ebp),%eax
c010340a:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010340f:	89 04 24             	mov    %eax,(%esp)
c0103412:	e8 2b ff ff ff       	call   c0103342 <pa2page>
}
c0103417:	c9                   	leave  
c0103418:	c3                   	ret    

c0103419 <pde2page>:

static inline struct Page *
pde2page(pde_t pde) {
c0103419:	55                   	push   %ebp
c010341a:	89 e5                	mov    %esp,%ebp
c010341c:	83 ec 18             	sub    $0x18,%esp
    return pa2page(PDE_ADDR(pde));
c010341f:	8b 45 08             	mov    0x8(%ebp),%eax
c0103422:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103427:	89 04 24             	mov    %eax,(%esp)
c010342a:	e8 13 ff ff ff       	call   c0103342 <pa2page>
}
c010342f:	c9                   	leave  
c0103430:	c3                   	ret    

c0103431 <page_ref>:

static inline int
page_ref(struct Page *page) {
c0103431:	55                   	push   %ebp
c0103432:	89 e5                	mov    %esp,%ebp
    return page->ref;
c0103434:	8b 45 08             	mov    0x8(%ebp),%eax
c0103437:	8b 00                	mov    (%eax),%eax
}
c0103439:	5d                   	pop    %ebp
c010343a:	c3                   	ret    

c010343b <set_page_ref>:

static inline void
set_page_ref(struct Page *page, int val) {
c010343b:	55                   	push   %ebp
c010343c:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c010343e:	8b 45 08             	mov    0x8(%ebp),%eax
c0103441:	8b 55 0c             	mov    0xc(%ebp),%edx
c0103444:	89 10                	mov    %edx,(%eax)
}
c0103446:	90                   	nop
c0103447:	5d                   	pop    %ebp
c0103448:	c3                   	ret    

c0103449 <page_ref_inc>:

static inline int
page_ref_inc(struct Page *page) {
c0103449:	55                   	push   %ebp
c010344a:	89 e5                	mov    %esp,%ebp
    page->ref += 1;
c010344c:	8b 45 08             	mov    0x8(%ebp),%eax
c010344f:	8b 00                	mov    (%eax),%eax
c0103451:	8d 50 01             	lea    0x1(%eax),%edx
c0103454:	8b 45 08             	mov    0x8(%ebp),%eax
c0103457:	89 10                	mov    %edx,(%eax)
    return page->ref;
c0103459:	8b 45 08             	mov    0x8(%ebp),%eax
c010345c:	8b 00                	mov    (%eax),%eax
}
c010345e:	5d                   	pop    %ebp
c010345f:	c3                   	ret    

c0103460 <page_ref_dec>:

static inline int
page_ref_dec(struct Page *page) {
c0103460:	55                   	push   %ebp
c0103461:	89 e5                	mov    %esp,%ebp
    page->ref -= 1;
c0103463:	8b 45 08             	mov    0x8(%ebp),%eax
c0103466:	8b 00                	mov    (%eax),%eax
c0103468:	8d 50 ff             	lea    -0x1(%eax),%edx
c010346b:	8b 45 08             	mov    0x8(%ebp),%eax
c010346e:	89 10                	mov    %edx,(%eax)
    return page->ref;
c0103470:	8b 45 08             	mov    0x8(%ebp),%eax
c0103473:	8b 00                	mov    (%eax),%eax
}
c0103475:	5d                   	pop    %ebp
c0103476:	c3                   	ret    

c0103477 <__intr_save>:
__intr_save(void) {
c0103477:	55                   	push   %ebp
c0103478:	89 e5                	mov    %esp,%ebp
c010347a:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c010347d:	9c                   	pushf  
c010347e:	58                   	pop    %eax
c010347f:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0103482:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0103485:	25 00 02 00 00       	and    $0x200,%eax
c010348a:	85 c0                	test   %eax,%eax
c010348c:	74 0c                	je     c010349a <__intr_save+0x23>
        intr_disable();
c010348e:	e8 71 ed ff ff       	call   c0102204 <intr_disable>
        return 1;
c0103493:	b8 01 00 00 00       	mov    $0x1,%eax
c0103498:	eb 05                	jmp    c010349f <__intr_save+0x28>
    return 0;
c010349a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010349f:	c9                   	leave  
c01034a0:	c3                   	ret    

c01034a1 <__intr_restore>:
__intr_restore(bool flag) {
c01034a1:	55                   	push   %ebp
c01034a2:	89 e5                	mov    %esp,%ebp
c01034a4:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c01034a7:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01034ab:	74 05                	je     c01034b2 <__intr_restore+0x11>
        intr_enable();
c01034ad:	e8 46 ed ff ff       	call   c01021f8 <intr_enable>
}
c01034b2:	90                   	nop
c01034b3:	c9                   	leave  
c01034b4:	c3                   	ret    

c01034b5 <lgdt>:
/* *
 * lgdt - load the global descriptor table register and reset the
 * data/code segement registers for kernel.
 * */
static inline void
lgdt(struct pseudodesc *pd) {
c01034b5:	55                   	push   %ebp
c01034b6:	89 e5                	mov    %esp,%ebp
    asm volatile ("lgdt (%0)" :: "r" (pd));
c01034b8:	8b 45 08             	mov    0x8(%ebp),%eax
c01034bb:	0f 01 10             	lgdtl  (%eax)
    asm volatile ("movw %%ax, %%gs" :: "a" (USER_DS));
c01034be:	b8 23 00 00 00       	mov    $0x23,%eax
c01034c3:	8e e8                	mov    %eax,%gs
    asm volatile ("movw %%ax, %%fs" :: "a" (USER_DS));
c01034c5:	b8 23 00 00 00       	mov    $0x23,%eax
c01034ca:	8e e0                	mov    %eax,%fs
    asm volatile ("movw %%ax, %%es" :: "a" (KERNEL_DS));
c01034cc:	b8 10 00 00 00       	mov    $0x10,%eax
c01034d1:	8e c0                	mov    %eax,%es
    asm volatile ("movw %%ax, %%ds" :: "a" (KERNEL_DS));
c01034d3:	b8 10 00 00 00       	mov    $0x10,%eax
c01034d8:	8e d8                	mov    %eax,%ds
    asm volatile ("movw %%ax, %%ss" :: "a" (KERNEL_DS));
c01034da:	b8 10 00 00 00       	mov    $0x10,%eax
c01034df:	8e d0                	mov    %eax,%ss
    // reload cs
    asm volatile ("ljmp %0, $1f\n 1:\n" :: "i" (KERNEL_CS));
c01034e1:	ea e8 34 10 c0 08 00 	ljmp   $0x8,$0xc01034e8
}
c01034e8:	90                   	nop
c01034e9:	5d                   	pop    %ebp
c01034ea:	c3                   	ret    

c01034eb <load_esp0>:
 * load_esp0 - change the ESP0 in default task state segment,
 * so that we can use different kernel stack when we trap frame
 * user to kernel.
 * */
void
load_esp0(uintptr_t esp0) {
c01034eb:	f3 0f 1e fb          	endbr32 
c01034ef:	55                   	push   %ebp
c01034f0:	89 e5                	mov    %esp,%ebp
    ts.ts_esp0 = esp0;
c01034f2:	8b 45 08             	mov    0x8(%ebp),%eax
c01034f5:	a3 a4 bf 12 c0       	mov    %eax,0xc012bfa4
}
c01034fa:	90                   	nop
c01034fb:	5d                   	pop    %ebp
c01034fc:	c3                   	ret    

c01034fd <gdt_init>:

/* gdt_init - initialize the default GDT and TSS */
static void
gdt_init(void) {
c01034fd:	f3 0f 1e fb          	endbr32 
c0103501:	55                   	push   %ebp
c0103502:	89 e5                	mov    %esp,%ebp
c0103504:	83 ec 14             	sub    $0x14,%esp
    // set boot kernel stack and default SS0
    load_esp0((uintptr_t)bootstacktop);
c0103507:	b8 00 80 12 c0       	mov    $0xc0128000,%eax
c010350c:	89 04 24             	mov    %eax,(%esp)
c010350f:	e8 d7 ff ff ff       	call   c01034eb <load_esp0>
    ts.ts_ss0 = KERNEL_DS;
c0103514:	66 c7 05 a8 bf 12 c0 	movw   $0x10,0xc012bfa8
c010351b:	10 00 

    // initialize the TSS filed of the gdt
    gdt[SEG_TSS] = SEGTSS(STS_T32A, (uintptr_t)&ts, sizeof(ts), DPL_KERNEL);
c010351d:	66 c7 05 28 8a 12 c0 	movw   $0x68,0xc0128a28
c0103524:	68 00 
c0103526:	b8 a0 bf 12 c0       	mov    $0xc012bfa0,%eax
c010352b:	0f b7 c0             	movzwl %ax,%eax
c010352e:	66 a3 2a 8a 12 c0    	mov    %ax,0xc0128a2a
c0103534:	b8 a0 bf 12 c0       	mov    $0xc012bfa0,%eax
c0103539:	c1 e8 10             	shr    $0x10,%eax
c010353c:	a2 2c 8a 12 c0       	mov    %al,0xc0128a2c
c0103541:	0f b6 05 2d 8a 12 c0 	movzbl 0xc0128a2d,%eax
c0103548:	24 f0                	and    $0xf0,%al
c010354a:	0c 09                	or     $0x9,%al
c010354c:	a2 2d 8a 12 c0       	mov    %al,0xc0128a2d
c0103551:	0f b6 05 2d 8a 12 c0 	movzbl 0xc0128a2d,%eax
c0103558:	24 ef                	and    $0xef,%al
c010355a:	a2 2d 8a 12 c0       	mov    %al,0xc0128a2d
c010355f:	0f b6 05 2d 8a 12 c0 	movzbl 0xc0128a2d,%eax
c0103566:	24 9f                	and    $0x9f,%al
c0103568:	a2 2d 8a 12 c0       	mov    %al,0xc0128a2d
c010356d:	0f b6 05 2d 8a 12 c0 	movzbl 0xc0128a2d,%eax
c0103574:	0c 80                	or     $0x80,%al
c0103576:	a2 2d 8a 12 c0       	mov    %al,0xc0128a2d
c010357b:	0f b6 05 2e 8a 12 c0 	movzbl 0xc0128a2e,%eax
c0103582:	24 f0                	and    $0xf0,%al
c0103584:	a2 2e 8a 12 c0       	mov    %al,0xc0128a2e
c0103589:	0f b6 05 2e 8a 12 c0 	movzbl 0xc0128a2e,%eax
c0103590:	24 ef                	and    $0xef,%al
c0103592:	a2 2e 8a 12 c0       	mov    %al,0xc0128a2e
c0103597:	0f b6 05 2e 8a 12 c0 	movzbl 0xc0128a2e,%eax
c010359e:	24 df                	and    $0xdf,%al
c01035a0:	a2 2e 8a 12 c0       	mov    %al,0xc0128a2e
c01035a5:	0f b6 05 2e 8a 12 c0 	movzbl 0xc0128a2e,%eax
c01035ac:	0c 40                	or     $0x40,%al
c01035ae:	a2 2e 8a 12 c0       	mov    %al,0xc0128a2e
c01035b3:	0f b6 05 2e 8a 12 c0 	movzbl 0xc0128a2e,%eax
c01035ba:	24 7f                	and    $0x7f,%al
c01035bc:	a2 2e 8a 12 c0       	mov    %al,0xc0128a2e
c01035c1:	b8 a0 bf 12 c0       	mov    $0xc012bfa0,%eax
c01035c6:	c1 e8 18             	shr    $0x18,%eax
c01035c9:	a2 2f 8a 12 c0       	mov    %al,0xc0128a2f

    // reload all segment registers
    lgdt(&gdt_pd);
c01035ce:	c7 04 24 30 8a 12 c0 	movl   $0xc0128a30,(%esp)
c01035d5:	e8 db fe ff ff       	call   c01034b5 <lgdt>
c01035da:	66 c7 45 fe 28 00    	movw   $0x28,-0x2(%ebp)
    asm volatile ("ltr %0" :: "r" (sel) : "memory");
c01035e0:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c01035e4:	0f 00 d8             	ltr    %ax
}
c01035e7:	90                   	nop

    // load the TSS
    ltr(GD_TSS);
}
c01035e8:	90                   	nop
c01035e9:	c9                   	leave  
c01035ea:	c3                   	ret    

c01035eb <init_pmm_manager>:

//init_pmm_manager - initialize a pmm_manager instance
static void
init_pmm_manager(void) {
c01035eb:	f3 0f 1e fb          	endbr32 
c01035ef:	55                   	push   %ebp
c01035f0:	89 e5                	mov    %esp,%ebp
c01035f2:	83 ec 18             	sub    $0x18,%esp
    pmm_manager = &default_pmm_manager;
c01035f5:	c7 05 58 e0 12 c0 b4 	movl   $0xc010beb4,0xc012e058
c01035fc:	be 10 c0 
    cprintf("memory management: %s\n", pmm_manager->name);
c01035ff:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c0103604:	8b 00                	mov    (%eax),%eax
c0103606:	89 44 24 04          	mov    %eax,0x4(%esp)
c010360a:	c7 04 24 30 aa 10 c0 	movl   $0xc010aa30,(%esp)
c0103611:	e8 bb cc ff ff       	call   c01002d1 <cprintf>
    pmm_manager->init();
c0103616:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c010361b:	8b 40 04             	mov    0x4(%eax),%eax
c010361e:	ff d0                	call   *%eax
}
c0103620:	90                   	nop
c0103621:	c9                   	leave  
c0103622:	c3                   	ret    

c0103623 <init_memmap>:

//init_memmap - call pmm->init_memmap to build Page struct for free memory  
static void
init_memmap(struct Page *base, size_t n) {
c0103623:	f3 0f 1e fb          	endbr32 
c0103627:	55                   	push   %ebp
c0103628:	89 e5                	mov    %esp,%ebp
c010362a:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->init_memmap(base, n);
c010362d:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c0103632:	8b 40 08             	mov    0x8(%eax),%eax
c0103635:	8b 55 0c             	mov    0xc(%ebp),%edx
c0103638:	89 54 24 04          	mov    %edx,0x4(%esp)
c010363c:	8b 55 08             	mov    0x8(%ebp),%edx
c010363f:	89 14 24             	mov    %edx,(%esp)
c0103642:	ff d0                	call   *%eax
}
c0103644:	90                   	nop
c0103645:	c9                   	leave  
c0103646:	c3                   	ret    

c0103647 <alloc_pages>:

//alloc_pages - call pmm->alloc_pages to allocate a continuous n*PAGESIZE memory 
struct Page *
alloc_pages(size_t n) {
c0103647:	f3 0f 1e fb          	endbr32 
c010364b:	55                   	push   %ebp
c010364c:	89 e5                	mov    %esp,%ebp
c010364e:	83 ec 28             	sub    $0x28,%esp
    struct Page *page=NULL;
c0103651:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    
    while (1)
    {
         local_intr_save(intr_flag);
c0103658:	e8 1a fe ff ff       	call   c0103477 <__intr_save>
c010365d:	89 45 f0             	mov    %eax,-0x10(%ebp)
         {
              page = pmm_manager->alloc_pages(n);
c0103660:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c0103665:	8b 40 0c             	mov    0xc(%eax),%eax
c0103668:	8b 55 08             	mov    0x8(%ebp),%edx
c010366b:	89 14 24             	mov    %edx,(%esp)
c010366e:	ff d0                	call   *%eax
c0103670:	89 45 f4             	mov    %eax,-0xc(%ebp)
         }
         local_intr_restore(intr_flag);
c0103673:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103676:	89 04 24             	mov    %eax,(%esp)
c0103679:	e8 23 fe ff ff       	call   c01034a1 <__intr_restore>

         if (page != NULL || n > 1 || swap_init_ok == 0) break;
c010367e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103682:	75 2d                	jne    c01036b1 <alloc_pages+0x6a>
c0103684:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
c0103688:	77 27                	ja     c01036b1 <alloc_pages+0x6a>
c010368a:	a1 14 c0 12 c0       	mov    0xc012c014,%eax
c010368f:	85 c0                	test   %eax,%eax
c0103691:	74 1e                	je     c01036b1 <alloc_pages+0x6a>
         
         extern struct mm_struct *check_mm_struct;
         //cprintf("page %x, call swap_out in alloc_pages %d\n",page, n);
         swap_out(check_mm_struct, n, 0);
c0103693:	8b 55 08             	mov    0x8(%ebp),%edx
c0103696:	a1 6c e0 12 c0       	mov    0xc012e06c,%eax
c010369b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01036a2:	00 
c01036a3:	89 54 24 04          	mov    %edx,0x4(%esp)
c01036a7:	89 04 24             	mov    %eax,(%esp)
c01036aa:	e8 b5 32 00 00       	call   c0106964 <swap_out>
    {
c01036af:	eb a7                	jmp    c0103658 <alloc_pages+0x11>
    }
    //cprintf("n %d,get page %x, No %d in alloc_pages\n",n,page,(page-pages));
    return page;
c01036b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01036b4:	c9                   	leave  
c01036b5:	c3                   	ret    

c01036b6 <free_pages>:

//free_pages - call pmm->free_pages to free a continuous n*PAGESIZE memory 
void
free_pages(struct Page *base, size_t n) {
c01036b6:	f3 0f 1e fb          	endbr32 
c01036ba:	55                   	push   %ebp
c01036bb:	89 e5                	mov    %esp,%ebp
c01036bd:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c01036c0:	e8 b2 fd ff ff       	call   c0103477 <__intr_save>
c01036c5:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        pmm_manager->free_pages(base, n);
c01036c8:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c01036cd:	8b 40 10             	mov    0x10(%eax),%eax
c01036d0:	8b 55 0c             	mov    0xc(%ebp),%edx
c01036d3:	89 54 24 04          	mov    %edx,0x4(%esp)
c01036d7:	8b 55 08             	mov    0x8(%ebp),%edx
c01036da:	89 14 24             	mov    %edx,(%esp)
c01036dd:	ff d0                	call   *%eax
    }
    local_intr_restore(intr_flag);
c01036df:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01036e2:	89 04 24             	mov    %eax,(%esp)
c01036e5:	e8 b7 fd ff ff       	call   c01034a1 <__intr_restore>
}
c01036ea:	90                   	nop
c01036eb:	c9                   	leave  
c01036ec:	c3                   	ret    

c01036ed <nr_free_pages>:

//nr_free_pages - call pmm->nr_free_pages to get the size (nr*PAGESIZE) 
//of current free memory
size_t
nr_free_pages(void) {
c01036ed:	f3 0f 1e fb          	endbr32 
c01036f1:	55                   	push   %ebp
c01036f2:	89 e5                	mov    %esp,%ebp
c01036f4:	83 ec 28             	sub    $0x28,%esp
    size_t ret;
    bool intr_flag;
    local_intr_save(intr_flag);
c01036f7:	e8 7b fd ff ff       	call   c0103477 <__intr_save>
c01036fc:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        ret = pmm_manager->nr_free_pages();
c01036ff:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c0103704:	8b 40 14             	mov    0x14(%eax),%eax
c0103707:	ff d0                	call   *%eax
c0103709:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    local_intr_restore(intr_flag);
c010370c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010370f:	89 04 24             	mov    %eax,(%esp)
c0103712:	e8 8a fd ff ff       	call   c01034a1 <__intr_restore>
    return ret;
c0103717:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c010371a:	c9                   	leave  
c010371b:	c3                   	ret    

c010371c <page_init>:

/* pmm_init - initialize the physical memory management */
static void
page_init(void) {
c010371c:	f3 0f 1e fb          	endbr32 
c0103720:	55                   	push   %ebp
c0103721:	89 e5                	mov    %esp,%ebp
c0103723:	57                   	push   %edi
c0103724:	56                   	push   %esi
c0103725:	53                   	push   %ebx
c0103726:	81 ec 9c 00 00 00    	sub    $0x9c,%esp
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
c010372c:	c7 45 c4 00 80 00 c0 	movl   $0xc0008000,-0x3c(%ebp)
    uint64_t maxpa = 0;
c0103733:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c010373a:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)

    cprintf("e820map:\n");
c0103741:	c7 04 24 47 aa 10 c0 	movl   $0xc010aa47,(%esp)
c0103748:	e8 84 cb ff ff       	call   c01002d1 <cprintf>
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c010374d:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0103754:	e9 1a 01 00 00       	jmp    c0103873 <page_init+0x157>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0103759:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c010375c:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010375f:	89 d0                	mov    %edx,%eax
c0103761:	c1 e0 02             	shl    $0x2,%eax
c0103764:	01 d0                	add    %edx,%eax
c0103766:	c1 e0 02             	shl    $0x2,%eax
c0103769:	01 c8                	add    %ecx,%eax
c010376b:	8b 50 08             	mov    0x8(%eax),%edx
c010376e:	8b 40 04             	mov    0x4(%eax),%eax
c0103771:	89 45 a0             	mov    %eax,-0x60(%ebp)
c0103774:	89 55 a4             	mov    %edx,-0x5c(%ebp)
c0103777:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c010377a:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010377d:	89 d0                	mov    %edx,%eax
c010377f:	c1 e0 02             	shl    $0x2,%eax
c0103782:	01 d0                	add    %edx,%eax
c0103784:	c1 e0 02             	shl    $0x2,%eax
c0103787:	01 c8                	add    %ecx,%eax
c0103789:	8b 48 0c             	mov    0xc(%eax),%ecx
c010378c:	8b 58 10             	mov    0x10(%eax),%ebx
c010378f:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0103792:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0103795:	01 c8                	add    %ecx,%eax
c0103797:	11 da                	adc    %ebx,%edx
c0103799:	89 45 98             	mov    %eax,-0x68(%ebp)
c010379c:	89 55 9c             	mov    %edx,-0x64(%ebp)
        cprintf("  memory: %08llx, [%08llx, %08llx], type = %d.\n",
c010379f:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c01037a2:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01037a5:	89 d0                	mov    %edx,%eax
c01037a7:	c1 e0 02             	shl    $0x2,%eax
c01037aa:	01 d0                	add    %edx,%eax
c01037ac:	c1 e0 02             	shl    $0x2,%eax
c01037af:	01 c8                	add    %ecx,%eax
c01037b1:	83 c0 14             	add    $0x14,%eax
c01037b4:	8b 00                	mov    (%eax),%eax
c01037b6:	89 45 84             	mov    %eax,-0x7c(%ebp)
c01037b9:	8b 45 98             	mov    -0x68(%ebp),%eax
c01037bc:	8b 55 9c             	mov    -0x64(%ebp),%edx
c01037bf:	83 c0 ff             	add    $0xffffffff,%eax
c01037c2:	83 d2 ff             	adc    $0xffffffff,%edx
c01037c5:	89 85 78 ff ff ff    	mov    %eax,-0x88(%ebp)
c01037cb:	89 95 7c ff ff ff    	mov    %edx,-0x84(%ebp)
c01037d1:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c01037d4:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01037d7:	89 d0                	mov    %edx,%eax
c01037d9:	c1 e0 02             	shl    $0x2,%eax
c01037dc:	01 d0                	add    %edx,%eax
c01037de:	c1 e0 02             	shl    $0x2,%eax
c01037e1:	01 c8                	add    %ecx,%eax
c01037e3:	8b 48 0c             	mov    0xc(%eax),%ecx
c01037e6:	8b 58 10             	mov    0x10(%eax),%ebx
c01037e9:	8b 55 84             	mov    -0x7c(%ebp),%edx
c01037ec:	89 54 24 1c          	mov    %edx,0x1c(%esp)
c01037f0:	8b 85 78 ff ff ff    	mov    -0x88(%ebp),%eax
c01037f6:	8b 95 7c ff ff ff    	mov    -0x84(%ebp),%edx
c01037fc:	89 44 24 14          	mov    %eax,0x14(%esp)
c0103800:	89 54 24 18          	mov    %edx,0x18(%esp)
c0103804:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0103807:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c010380a:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010380e:	89 54 24 10          	mov    %edx,0x10(%esp)
c0103812:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0103816:	89 5c 24 08          	mov    %ebx,0x8(%esp)
c010381a:	c7 04 24 54 aa 10 c0 	movl   $0xc010aa54,(%esp)
c0103821:	e8 ab ca ff ff       	call   c01002d1 <cprintf>
                memmap->map[i].size, begin, end - 1, memmap->map[i].type);
        if (memmap->map[i].type == E820_ARM) {
c0103826:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103829:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010382c:	89 d0                	mov    %edx,%eax
c010382e:	c1 e0 02             	shl    $0x2,%eax
c0103831:	01 d0                	add    %edx,%eax
c0103833:	c1 e0 02             	shl    $0x2,%eax
c0103836:	01 c8                	add    %ecx,%eax
c0103838:	83 c0 14             	add    $0x14,%eax
c010383b:	8b 00                	mov    (%eax),%eax
c010383d:	83 f8 01             	cmp    $0x1,%eax
c0103840:	75 2e                	jne    c0103870 <page_init+0x154>
            if (maxpa < end && begin < KMEMSIZE) {
c0103842:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103845:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0103848:	3b 45 98             	cmp    -0x68(%ebp),%eax
c010384b:	89 d0                	mov    %edx,%eax
c010384d:	1b 45 9c             	sbb    -0x64(%ebp),%eax
c0103850:	73 1e                	jae    c0103870 <page_init+0x154>
c0103852:	ba ff ff ff 37       	mov    $0x37ffffff,%edx
c0103857:	b8 00 00 00 00       	mov    $0x0,%eax
c010385c:	3b 55 a0             	cmp    -0x60(%ebp),%edx
c010385f:	1b 45 a4             	sbb    -0x5c(%ebp),%eax
c0103862:	72 0c                	jb     c0103870 <page_init+0x154>
                maxpa = end;
c0103864:	8b 45 98             	mov    -0x68(%ebp),%eax
c0103867:	8b 55 9c             	mov    -0x64(%ebp),%edx
c010386a:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010386d:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    for (i = 0; i < memmap->nr_map; i ++) {
c0103870:	ff 45 dc             	incl   -0x24(%ebp)
c0103873:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0103876:	8b 00                	mov    (%eax),%eax
c0103878:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c010387b:	0f 8c d8 fe ff ff    	jl     c0103759 <page_init+0x3d>
            }
        }
    }
    if (maxpa > KMEMSIZE) {
c0103881:	ba 00 00 00 38       	mov    $0x38000000,%edx
c0103886:	b8 00 00 00 00       	mov    $0x0,%eax
c010388b:	3b 55 e0             	cmp    -0x20(%ebp),%edx
c010388e:	1b 45 e4             	sbb    -0x1c(%ebp),%eax
c0103891:	73 0e                	jae    c01038a1 <page_init+0x185>
        maxpa = KMEMSIZE;
c0103893:	c7 45 e0 00 00 00 38 	movl   $0x38000000,-0x20(%ebp)
c010389a:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    }

    extern char end[];

    npage = maxpa / PGSIZE;
c01038a1:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01038a4:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01038a7:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c01038ab:	c1 ea 0c             	shr    $0xc,%edx
c01038ae:	a3 80 bf 12 c0       	mov    %eax,0xc012bf80
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
c01038b3:	c7 45 c0 00 10 00 00 	movl   $0x1000,-0x40(%ebp)
c01038ba:	b8 58 e1 12 c0       	mov    $0xc012e158,%eax
c01038bf:	8d 50 ff             	lea    -0x1(%eax),%edx
c01038c2:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01038c5:	01 d0                	add    %edx,%eax
c01038c7:	89 45 bc             	mov    %eax,-0x44(%ebp)
c01038ca:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01038cd:	ba 00 00 00 00       	mov    $0x0,%edx
c01038d2:	f7 75 c0             	divl   -0x40(%ebp)
c01038d5:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01038d8:	29 d0                	sub    %edx,%eax
c01038da:	a3 60 e0 12 c0       	mov    %eax,0xc012e060

    for (i = 0; i < npage; i ++) {
c01038df:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c01038e6:	eb 27                	jmp    c010390f <page_init+0x1f3>
        SetPageReserved(pages + i);
c01038e8:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c01038ed:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01038f0:	c1 e2 05             	shl    $0x5,%edx
c01038f3:	01 d0                	add    %edx,%eax
c01038f5:	83 c0 04             	add    $0x4,%eax
c01038f8:	c7 45 94 00 00 00 00 	movl   $0x0,-0x6c(%ebp)
c01038ff:	89 45 90             	mov    %eax,-0x70(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0103902:	8b 45 90             	mov    -0x70(%ebp),%eax
c0103905:	8b 55 94             	mov    -0x6c(%ebp),%edx
c0103908:	0f ab 10             	bts    %edx,(%eax)
}
c010390b:	90                   	nop
    for (i = 0; i < npage; i ++) {
c010390c:	ff 45 dc             	incl   -0x24(%ebp)
c010390f:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103912:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0103917:	39 c2                	cmp    %eax,%edx
c0103919:	72 cd                	jb     c01038e8 <page_init+0x1cc>
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);
c010391b:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0103920:	c1 e0 05             	shl    $0x5,%eax
c0103923:	89 c2                	mov    %eax,%edx
c0103925:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c010392a:	01 d0                	add    %edx,%eax
c010392c:	89 45 b8             	mov    %eax,-0x48(%ebp)
c010392f:	81 7d b8 ff ff ff bf 	cmpl   $0xbfffffff,-0x48(%ebp)
c0103936:	77 23                	ja     c010395b <page_init+0x23f>
c0103938:	8b 45 b8             	mov    -0x48(%ebp),%eax
c010393b:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010393f:	c7 44 24 08 84 aa 10 	movl   $0xc010aa84,0x8(%esp)
c0103946:	c0 
c0103947:	c7 44 24 04 ea 00 00 	movl   $0xea,0x4(%esp)
c010394e:	00 
c010394f:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0103956:	e8 e2 ca ff ff       	call   c010043d <__panic>
c010395b:	8b 45 b8             	mov    -0x48(%ebp),%eax
c010395e:	05 00 00 00 40       	add    $0x40000000,%eax
c0103963:	89 45 b4             	mov    %eax,-0x4c(%ebp)

    for (i = 0; i < memmap->nr_map; i ++) {
c0103966:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c010396d:	e9 4b 01 00 00       	jmp    c0103abd <page_init+0x3a1>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0103972:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103975:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103978:	89 d0                	mov    %edx,%eax
c010397a:	c1 e0 02             	shl    $0x2,%eax
c010397d:	01 d0                	add    %edx,%eax
c010397f:	c1 e0 02             	shl    $0x2,%eax
c0103982:	01 c8                	add    %ecx,%eax
c0103984:	8b 50 08             	mov    0x8(%eax),%edx
c0103987:	8b 40 04             	mov    0x4(%eax),%eax
c010398a:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010398d:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0103990:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103993:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103996:	89 d0                	mov    %edx,%eax
c0103998:	c1 e0 02             	shl    $0x2,%eax
c010399b:	01 d0                	add    %edx,%eax
c010399d:	c1 e0 02             	shl    $0x2,%eax
c01039a0:	01 c8                	add    %ecx,%eax
c01039a2:	8b 48 0c             	mov    0xc(%eax),%ecx
c01039a5:	8b 58 10             	mov    0x10(%eax),%ebx
c01039a8:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01039ab:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01039ae:	01 c8                	add    %ecx,%eax
c01039b0:	11 da                	adc    %ebx,%edx
c01039b2:	89 45 c8             	mov    %eax,-0x38(%ebp)
c01039b5:	89 55 cc             	mov    %edx,-0x34(%ebp)
        if (memmap->map[i].type == E820_ARM) {
c01039b8:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c01039bb:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01039be:	89 d0                	mov    %edx,%eax
c01039c0:	c1 e0 02             	shl    $0x2,%eax
c01039c3:	01 d0                	add    %edx,%eax
c01039c5:	c1 e0 02             	shl    $0x2,%eax
c01039c8:	01 c8                	add    %ecx,%eax
c01039ca:	83 c0 14             	add    $0x14,%eax
c01039cd:	8b 00                	mov    (%eax),%eax
c01039cf:	83 f8 01             	cmp    $0x1,%eax
c01039d2:	0f 85 e2 00 00 00    	jne    c0103aba <page_init+0x39e>
            if (begin < freemem) {
c01039d8:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01039db:	ba 00 00 00 00       	mov    $0x0,%edx
c01039e0:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c01039e3:	39 45 d0             	cmp    %eax,-0x30(%ebp)
c01039e6:	19 d1                	sbb    %edx,%ecx
c01039e8:	73 0d                	jae    c01039f7 <page_init+0x2db>
                begin = freemem;
c01039ea:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01039ed:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01039f0:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
            }
            if (end > KMEMSIZE) {
c01039f7:	ba 00 00 00 38       	mov    $0x38000000,%edx
c01039fc:	b8 00 00 00 00       	mov    $0x0,%eax
c0103a01:	3b 55 c8             	cmp    -0x38(%ebp),%edx
c0103a04:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c0103a07:	73 0e                	jae    c0103a17 <page_init+0x2fb>
                end = KMEMSIZE;
c0103a09:	c7 45 c8 00 00 00 38 	movl   $0x38000000,-0x38(%ebp)
c0103a10:	c7 45 cc 00 00 00 00 	movl   $0x0,-0x34(%ebp)
            }
            if (begin < end) {
c0103a17:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103a1a:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103a1d:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c0103a20:	89 d0                	mov    %edx,%eax
c0103a22:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c0103a25:	0f 83 8f 00 00 00    	jae    c0103aba <page_init+0x39e>
                begin = ROUNDUP(begin, PGSIZE);
c0103a2b:	c7 45 b0 00 10 00 00 	movl   $0x1000,-0x50(%ebp)
c0103a32:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0103a35:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0103a38:	01 d0                	add    %edx,%eax
c0103a3a:	48                   	dec    %eax
c0103a3b:	89 45 ac             	mov    %eax,-0x54(%ebp)
c0103a3e:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0103a41:	ba 00 00 00 00       	mov    $0x0,%edx
c0103a46:	f7 75 b0             	divl   -0x50(%ebp)
c0103a49:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0103a4c:	29 d0                	sub    %edx,%eax
c0103a4e:	ba 00 00 00 00       	mov    $0x0,%edx
c0103a53:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0103a56:	89 55 d4             	mov    %edx,-0x2c(%ebp)
                end = ROUNDDOWN(end, PGSIZE);
c0103a59:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0103a5c:	89 45 a8             	mov    %eax,-0x58(%ebp)
c0103a5f:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0103a62:	ba 00 00 00 00       	mov    $0x0,%edx
c0103a67:	89 c3                	mov    %eax,%ebx
c0103a69:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
c0103a6f:	89 de                	mov    %ebx,%esi
c0103a71:	89 d0                	mov    %edx,%eax
c0103a73:	83 e0 00             	and    $0x0,%eax
c0103a76:	89 c7                	mov    %eax,%edi
c0103a78:	89 75 c8             	mov    %esi,-0x38(%ebp)
c0103a7b:	89 7d cc             	mov    %edi,-0x34(%ebp)
                if (begin < end) {
c0103a7e:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103a81:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103a84:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c0103a87:	89 d0                	mov    %edx,%eax
c0103a89:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c0103a8c:	73 2c                	jae    c0103aba <page_init+0x39e>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
c0103a8e:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0103a91:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0103a94:	2b 45 d0             	sub    -0x30(%ebp),%eax
c0103a97:	1b 55 d4             	sbb    -0x2c(%ebp),%edx
c0103a9a:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0103a9e:	c1 ea 0c             	shr    $0xc,%edx
c0103aa1:	89 c3                	mov    %eax,%ebx
c0103aa3:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103aa6:	89 04 24             	mov    %eax,(%esp)
c0103aa9:	e8 94 f8 ff ff       	call   c0103342 <pa2page>
c0103aae:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0103ab2:	89 04 24             	mov    %eax,(%esp)
c0103ab5:	e8 69 fb ff ff       	call   c0103623 <init_memmap>
    for (i = 0; i < memmap->nr_map; i ++) {
c0103aba:	ff 45 dc             	incl   -0x24(%ebp)
c0103abd:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0103ac0:	8b 00                	mov    (%eax),%eax
c0103ac2:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c0103ac5:	0f 8c a7 fe ff ff    	jl     c0103972 <page_init+0x256>
                }
            }
        }
    }
}
c0103acb:	90                   	nop
c0103acc:	90                   	nop
c0103acd:	81 c4 9c 00 00 00    	add    $0x9c,%esp
c0103ad3:	5b                   	pop    %ebx
c0103ad4:	5e                   	pop    %esi
c0103ad5:	5f                   	pop    %edi
c0103ad6:	5d                   	pop    %ebp
c0103ad7:	c3                   	ret    

c0103ad8 <boot_map_segment>:
//  la:   linear address of this memory need to map (after x86 segment map)
//  size: memory size
//  pa:   physical address of this memory
//  perm: permission of this memory  
static void
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
c0103ad8:	f3 0f 1e fb          	endbr32 
c0103adc:	55                   	push   %ebp
c0103add:	89 e5                	mov    %esp,%ebp
c0103adf:	83 ec 38             	sub    $0x38,%esp
    assert(PGOFF(la) == PGOFF(pa));
c0103ae2:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103ae5:	33 45 14             	xor    0x14(%ebp),%eax
c0103ae8:	25 ff 0f 00 00       	and    $0xfff,%eax
c0103aed:	85 c0                	test   %eax,%eax
c0103aef:	74 24                	je     c0103b15 <boot_map_segment+0x3d>
c0103af1:	c7 44 24 0c b6 aa 10 	movl   $0xc010aab6,0xc(%esp)
c0103af8:	c0 
c0103af9:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0103b00:	c0 
c0103b01:	c7 44 24 04 08 01 00 	movl   $0x108,0x4(%esp)
c0103b08:	00 
c0103b09:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0103b10:	e8 28 c9 ff ff       	call   c010043d <__panic>
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
c0103b15:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
c0103b1c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103b1f:	25 ff 0f 00 00       	and    $0xfff,%eax
c0103b24:	89 c2                	mov    %eax,%edx
c0103b26:	8b 45 10             	mov    0x10(%ebp),%eax
c0103b29:	01 c2                	add    %eax,%edx
c0103b2b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103b2e:	01 d0                	add    %edx,%eax
c0103b30:	48                   	dec    %eax
c0103b31:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0103b34:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103b37:	ba 00 00 00 00       	mov    $0x0,%edx
c0103b3c:	f7 75 f0             	divl   -0x10(%ebp)
c0103b3f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103b42:	29 d0                	sub    %edx,%eax
c0103b44:	c1 e8 0c             	shr    $0xc,%eax
c0103b47:	89 45 f4             	mov    %eax,-0xc(%ebp)
    la = ROUNDDOWN(la, PGSIZE);
c0103b4a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103b4d:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0103b50:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103b53:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103b58:	89 45 0c             	mov    %eax,0xc(%ebp)
    pa = ROUNDDOWN(pa, PGSIZE);
c0103b5b:	8b 45 14             	mov    0x14(%ebp),%eax
c0103b5e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0103b61:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103b64:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103b69:	89 45 14             	mov    %eax,0x14(%ebp)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c0103b6c:	eb 68                	jmp    c0103bd6 <boot_map_segment+0xfe>
        pte_t *ptep = get_pte(pgdir, la, 1);
c0103b6e:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0103b75:	00 
c0103b76:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103b79:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103b7d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103b80:	89 04 24             	mov    %eax,(%esp)
c0103b83:	e8 8f 01 00 00       	call   c0103d17 <get_pte>
c0103b88:	89 45 e0             	mov    %eax,-0x20(%ebp)
        assert(ptep != NULL);
c0103b8b:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0103b8f:	75 24                	jne    c0103bb5 <boot_map_segment+0xdd>
c0103b91:	c7 44 24 0c e2 aa 10 	movl   $0xc010aae2,0xc(%esp)
c0103b98:	c0 
c0103b99:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0103ba0:	c0 
c0103ba1:	c7 44 24 04 0e 01 00 	movl   $0x10e,0x4(%esp)
c0103ba8:	00 
c0103ba9:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0103bb0:	e8 88 c8 ff ff       	call   c010043d <__panic>
        *ptep = pa | PTE_P | perm;
c0103bb5:	8b 45 14             	mov    0x14(%ebp),%eax
c0103bb8:	0b 45 18             	or     0x18(%ebp),%eax
c0103bbb:	83 c8 01             	or     $0x1,%eax
c0103bbe:	89 c2                	mov    %eax,%edx
c0103bc0:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103bc3:	89 10                	mov    %edx,(%eax)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c0103bc5:	ff 4d f4             	decl   -0xc(%ebp)
c0103bc8:	81 45 0c 00 10 00 00 	addl   $0x1000,0xc(%ebp)
c0103bcf:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
c0103bd6:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103bda:	75 92                	jne    c0103b6e <boot_map_segment+0x96>
    }
}
c0103bdc:	90                   	nop
c0103bdd:	90                   	nop
c0103bde:	c9                   	leave  
c0103bdf:	c3                   	ret    

c0103be0 <boot_alloc_page>:

//boot_alloc_page - allocate one page using pmm->alloc_pages(1) 
// return value: the kernel virtual address of this allocated page
//note: this function is used to get the memory for PDT(Page Directory Table)&PT(Page Table)
static void *
boot_alloc_page(void) {
c0103be0:	f3 0f 1e fb          	endbr32 
c0103be4:	55                   	push   %ebp
c0103be5:	89 e5                	mov    %esp,%ebp
c0103be7:	83 ec 28             	sub    $0x28,%esp
    struct Page *p = alloc_page();
c0103bea:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103bf1:	e8 51 fa ff ff       	call   c0103647 <alloc_pages>
c0103bf6:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (p == NULL) {
c0103bf9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103bfd:	75 1c                	jne    c0103c1b <boot_alloc_page+0x3b>
        panic("boot_alloc_page failed.\n");
c0103bff:	c7 44 24 08 ef aa 10 	movl   $0xc010aaef,0x8(%esp)
c0103c06:	c0 
c0103c07:	c7 44 24 04 1a 01 00 	movl   $0x11a,0x4(%esp)
c0103c0e:	00 
c0103c0f:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0103c16:	e8 22 c8 ff ff       	call   c010043d <__panic>
    }
    return page2kva(p);
c0103c1b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103c1e:	89 04 24             	mov    %eax,(%esp)
c0103c21:	e8 61 f7 ff ff       	call   c0103387 <page2kva>
}
c0103c26:	c9                   	leave  
c0103c27:	c3                   	ret    

c0103c28 <pmm_init>:

//pmm_init - setup a pmm to manage physical memory, build PDT&PT to setup paging mechanism 
//         - check the correctness of pmm & paging mechanism, print PDT&PT
void
pmm_init(void) {
c0103c28:	f3 0f 1e fb          	endbr32 
c0103c2c:	55                   	push   %ebp
c0103c2d:	89 e5                	mov    %esp,%ebp
c0103c2f:	83 ec 38             	sub    $0x38,%esp
    // We've already enabled paging
    boot_cr3 = PADDR(boot_pgdir);
c0103c32:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0103c37:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103c3a:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0103c41:	77 23                	ja     c0103c66 <pmm_init+0x3e>
c0103c43:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103c46:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103c4a:	c7 44 24 08 84 aa 10 	movl   $0xc010aa84,0x8(%esp)
c0103c51:	c0 
c0103c52:	c7 44 24 04 24 01 00 	movl   $0x124,0x4(%esp)
c0103c59:	00 
c0103c5a:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0103c61:	e8 d7 c7 ff ff       	call   c010043d <__panic>
c0103c66:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103c69:	05 00 00 00 40       	add    $0x40000000,%eax
c0103c6e:	a3 5c e0 12 c0       	mov    %eax,0xc012e05c
    //We need to alloc/free the physical memory (granularity is 4KB or other size). 
    //So a framework of physical memory manager (struct pmm_manager)is defined in pmm.h
    //First we should init a physical memory manager(pmm) based on the framework.
    //Then pmm can alloc/free the physical memory. 
    //Now the first_fit/best_fit/worst_fit/buddy_system pmm are available.
    init_pmm_manager();
c0103c73:	e8 73 f9 ff ff       	call   c01035eb <init_pmm_manager>

    // detect physical memory space, reserve already used memory,
    // then use pmm->init_memmap to create free page list
    page_init();
c0103c78:	e8 9f fa ff ff       	call   c010371c <page_init>

    //use pmm->check to verify the correctness of the alloc/free function in a pmm
    check_alloc_page();
c0103c7d:	e8 cc 04 00 00       	call   c010414e <check_alloc_page>

    check_pgdir();
c0103c82:	e8 ea 04 00 00       	call   c0104171 <check_pgdir>

    static_assert(KERNBASE % PTSIZE == 0 && KERNTOP % PTSIZE == 0);

    // recursively insert boot_pgdir in itself
    // to form a virtual page table at virtual address VPT
    boot_pgdir[PDX(VPT)] = PADDR(boot_pgdir) | PTE_P | PTE_W;
c0103c87:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0103c8c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103c8f:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c0103c96:	77 23                	ja     c0103cbb <pmm_init+0x93>
c0103c98:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103c9b:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103c9f:	c7 44 24 08 84 aa 10 	movl   $0xc010aa84,0x8(%esp)
c0103ca6:	c0 
c0103ca7:	c7 44 24 04 3a 01 00 	movl   $0x13a,0x4(%esp)
c0103cae:	00 
c0103caf:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0103cb6:	e8 82 c7 ff ff       	call   c010043d <__panic>
c0103cbb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103cbe:	8d 90 00 00 00 40    	lea    0x40000000(%eax),%edx
c0103cc4:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0103cc9:	05 ac 0f 00 00       	add    $0xfac,%eax
c0103cce:	83 ca 03             	or     $0x3,%edx
c0103cd1:	89 10                	mov    %edx,(%eax)

    // map all physical memory to linear memory with base linear addr KERNBASE
    // linear_addr KERNBASE ~ KERNBASE + KMEMSIZE = phy_addr 0 ~ KMEMSIZE
    boot_map_segment(boot_pgdir, KERNBASE, KMEMSIZE, 0, PTE_W);
c0103cd3:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0103cd8:	c7 44 24 10 02 00 00 	movl   $0x2,0x10(%esp)
c0103cdf:	00 
c0103ce0:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0103ce7:	00 
c0103ce8:	c7 44 24 08 00 00 00 	movl   $0x38000000,0x8(%esp)
c0103cef:	38 
c0103cf0:	c7 44 24 04 00 00 00 	movl   $0xc0000000,0x4(%esp)
c0103cf7:	c0 
c0103cf8:	89 04 24             	mov    %eax,(%esp)
c0103cfb:	e8 d8 fd ff ff       	call   c0103ad8 <boot_map_segment>

    // Since we are using bootloader's GDT,
    // we should reload gdt (second time, the last time) to get user segments and the TSS
    // map virtual_addr 0 ~ 4G = linear_addr 0 ~ 4G
    // then set kernel stack (ss:esp) in TSS, setup TSS in gdt, load TSS
    gdt_init();
c0103d00:	e8 f8 f7 ff ff       	call   c01034fd <gdt_init>

    //now the basic virtual memory map(see memalyout.h) is established.
    //check the correctness of the basic virtual memory map.
    check_boot_pgdir();
c0103d05:	e8 07 0b 00 00       	call   c0104811 <check_boot_pgdir>

    print_pgdir();
c0103d0a:	e8 8c 0f 00 00       	call   c0104c9b <print_pgdir>
    
    kmalloc_init();
c0103d0f:	e8 f2 27 00 00       	call   c0106506 <kmalloc_init>

}
c0103d14:	90                   	nop
c0103d15:	c9                   	leave  
c0103d16:	c3                   	ret    

c0103d17 <get_pte>:
//  pgdir:  the kernel virtual base address of PDT
//  la:     the linear address need to map
//  create: a logical value to decide if alloc a page for PT
// return vaule: the kernel virtual address of this pte
pte_t *
get_pte(pde_t *pgdir, uintptr_t la, bool create) {
c0103d17:	f3 0f 1e fb          	endbr32 
c0103d1b:	55                   	push   %ebp
c0103d1c:	89 e5                	mov    %esp,%ebp
c0103d1e:	83 ec 38             	sub    $0x38,%esp
     * DEFINEs:
     *   PTE_P           0x001                   // page table/directory entry flags bit : Present
     *   PTE_W           0x002                   // page table/directory entry flags bit : Writeable
     *   PTE_U           0x004                   // page table/directory entry flags bit : User can access
     */
    pde_t *pdep = &pgdir[PDX(la)];   // (1) find page directory entry
c0103d21:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103d24:	c1 e8 16             	shr    $0x16,%eax
c0103d27:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0103d2e:	8b 45 08             	mov    0x8(%ebp),%eax
c0103d31:	01 d0                	add    %edx,%eax
c0103d33:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (!(*pdep&PTE_P)) {              // (2) check if entry is not present
c0103d36:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103d39:	8b 00                	mov    (%eax),%eax
c0103d3b:	83 e0 01             	and    $0x1,%eax
c0103d3e:	85 c0                	test   %eax,%eax
c0103d40:	0f 85 af 00 00 00    	jne    c0103df5 <get_pte+0xde>
        struct Page* target;
	if(!create||!(target=alloc_page()))            // (3) check if creating is needed, then alloc page for page table
c0103d46:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0103d4a:	74 15                	je     c0103d61 <get_pte+0x4a>
c0103d4c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103d53:	e8 ef f8 ff ff       	call   c0103647 <alloc_pages>
c0103d58:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103d5b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0103d5f:	75 0a                	jne    c0103d6b <get_pte+0x54>
	    return NULL;             // CAUTION: this page is used for page table, not for common data page
c0103d61:	b8 00 00 00 00       	mov    $0x0,%eax
c0103d66:	e9 e7 00 00 00       	jmp    c0103e52 <get_pte+0x13b>
        set_page_ref(target,1);                  // (4) set page reference
c0103d6b:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103d72:	00 
c0103d73:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103d76:	89 04 24             	mov    %eax,(%esp)
c0103d79:	e8 bd f6 ff ff       	call   c010343b <set_page_ref>
        uintptr_t pa = page2pa(target); // (5) get linear address of page
c0103d7e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103d81:	89 04 24             	mov    %eax,(%esp)
c0103d84:	e8 a3 f5 ff ff       	call   c010332c <page2pa>
c0103d89:	89 45 ec             	mov    %eax,-0x14(%ebp)
        memset(KADDR(pa),0,PGSIZE);// (6) clear page content using memset
c0103d8c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103d8f:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0103d92:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103d95:	c1 e8 0c             	shr    $0xc,%eax
c0103d98:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0103d9b:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0103da0:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c0103da3:	72 23                	jb     c0103dc8 <get_pte+0xb1>
c0103da5:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103da8:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103dac:	c7 44 24 08 e0 a9 10 	movl   $0xc010a9e0,0x8(%esp)
c0103db3:	c0 
c0103db4:	c7 44 24 04 75 01 00 	movl   $0x175,0x4(%esp)
c0103dbb:	00 
c0103dbc:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0103dc3:	e8 75 c6 ff ff       	call   c010043d <__panic>
c0103dc8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103dcb:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0103dd0:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0103dd7:	00 
c0103dd8:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0103ddf:	00 
c0103de0:	89 04 24             	mov    %eax,(%esp)
c0103de3:	e8 50 59 00 00       	call   c0109738 <memset>
        *pdep=pa|PTE_P|PTE_W|PTE_U;                  // (7) set page directory entry's permission
c0103de8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103deb:	83 c8 07             	or     $0x7,%eax
c0103dee:	89 c2                	mov    %eax,%edx
c0103df0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103df3:	89 10                	mov    %edx,(%eax)
    }
    return &((pte_t *)KADDR(PDE_ADDR(*pdep)))[PTX(la)];          // (8) return page table entry
c0103df5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103df8:	8b 00                	mov    (%eax),%eax
c0103dfa:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103dff:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0103e02:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103e05:	c1 e8 0c             	shr    $0xc,%eax
c0103e08:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0103e0b:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0103e10:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c0103e13:	72 23                	jb     c0103e38 <get_pte+0x121>
c0103e15:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103e18:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103e1c:	c7 44 24 08 e0 a9 10 	movl   $0xc010a9e0,0x8(%esp)
c0103e23:	c0 
c0103e24:	c7 44 24 04 78 01 00 	movl   $0x178,0x4(%esp)
c0103e2b:	00 
c0103e2c:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0103e33:	e8 05 c6 ff ff       	call   c010043d <__panic>
c0103e38:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103e3b:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0103e40:	89 c2                	mov    %eax,%edx
c0103e42:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103e45:	c1 e8 0c             	shr    $0xc,%eax
c0103e48:	25 ff 03 00 00       	and    $0x3ff,%eax
c0103e4d:	c1 e0 02             	shl    $0x2,%eax
c0103e50:	01 d0                	add    %edx,%eax
}
c0103e52:	c9                   	leave  
c0103e53:	c3                   	ret    

c0103e54 <get_page>:

//get_page - get related Page struct for linear address la using PDT pgdir
struct Page *
get_page(pde_t *pgdir, uintptr_t la, pte_t **ptep_store) {
c0103e54:	f3 0f 1e fb          	endbr32 
c0103e58:	55                   	push   %ebp
c0103e59:	89 e5                	mov    %esp,%ebp
c0103e5b:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c0103e5e:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0103e65:	00 
c0103e66:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103e69:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103e6d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103e70:	89 04 24             	mov    %eax,(%esp)
c0103e73:	e8 9f fe ff ff       	call   c0103d17 <get_pte>
c0103e78:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep_store != NULL) {
c0103e7b:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0103e7f:	74 08                	je     c0103e89 <get_page+0x35>
        *ptep_store = ptep;
c0103e81:	8b 45 10             	mov    0x10(%ebp),%eax
c0103e84:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103e87:	89 10                	mov    %edx,(%eax)
    }
    if (ptep != NULL && *ptep & PTE_P) {
c0103e89:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103e8d:	74 1b                	je     c0103eaa <get_page+0x56>
c0103e8f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103e92:	8b 00                	mov    (%eax),%eax
c0103e94:	83 e0 01             	and    $0x1,%eax
c0103e97:	85 c0                	test   %eax,%eax
c0103e99:	74 0f                	je     c0103eaa <get_page+0x56>
        return pte2page(*ptep);
c0103e9b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103e9e:	8b 00                	mov    (%eax),%eax
c0103ea0:	89 04 24             	mov    %eax,(%esp)
c0103ea3:	e8 33 f5 ff ff       	call   c01033db <pte2page>
c0103ea8:	eb 05                	jmp    c0103eaf <get_page+0x5b>
    }
    return NULL;
c0103eaa:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0103eaf:	c9                   	leave  
c0103eb0:	c3                   	ret    

c0103eb1 <page_remove_pte>:

//page_remove_pte - free an Page sturct which is related linear address la
//                - and clean(invalidate) pte which is related linear address la
//note: PT is changed, so the TLB need to be invalidate 
static inline void
page_remove_pte(pde_t *pgdir, uintptr_t la, pte_t *ptep) {
c0103eb1:	55                   	push   %ebp
c0103eb2:	89 e5                	mov    %esp,%ebp
c0103eb4:	83 ec 28             	sub    $0x28,%esp
     *   tlb_invalidate(pde_t *pgdir, uintptr_t la) : Invalidate a TLB entry, but only if the page tables being
     *                        edited are the ones currently in use by the processor.
     * DEFINEs:
     *   PTE_P           0x001                   // page table/directory entry flags bit : Present
     */
    if (PTE_P&(*ptep)) {                      //(1) check if this page table entry is present
c0103eb7:	8b 45 10             	mov    0x10(%ebp),%eax
c0103eba:	8b 00                	mov    (%eax),%eax
c0103ebc:	83 e0 01             	and    $0x1,%eax
c0103ebf:	85 c0                	test   %eax,%eax
c0103ec1:	74 52                	je     c0103f15 <page_remove_pte+0x64>
        struct Page *page = pte2page(*ptep); //(2) find corresponding page to pte
c0103ec3:	8b 45 10             	mov    0x10(%ebp),%eax
c0103ec6:	8b 00                	mov    (%eax),%eax
c0103ec8:	89 04 24             	mov    %eax,(%esp)
c0103ecb:	e8 0b f5 ff ff       	call   c01033db <pte2page>
c0103ed0:	89 45 f4             	mov    %eax,-0xc(%ebp)
        page_ref_dec(page);                    //(3) decrease page reference
c0103ed3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103ed6:	89 04 24             	mov    %eax,(%esp)
c0103ed9:	e8 82 f5 ff ff       	call   c0103460 <page_ref_dec>
        if(!page->ref)   free_page(page);      //(4) and free this page when page reference reachs 0
c0103ede:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103ee1:	8b 00                	mov    (%eax),%eax
c0103ee3:	85 c0                	test   %eax,%eax
c0103ee5:	75 13                	jne    c0103efa <page_remove_pte+0x49>
c0103ee7:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103eee:	00 
c0103eef:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103ef2:	89 04 24             	mov    %eax,(%esp)
c0103ef5:	e8 bc f7 ff ff       	call   c01036b6 <free_pages>
        *ptep=0;                          //(5) clear second page table entry
c0103efa:	8b 45 10             	mov    0x10(%ebp),%eax
c0103efd:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        tlb_invalidate(pgdir,la);               //(6) flush tlb
c0103f03:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103f06:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103f0a:	8b 45 08             	mov    0x8(%ebp),%eax
c0103f0d:	89 04 24             	mov    %eax,(%esp)
c0103f10:	e8 09 01 00 00       	call   c010401e <tlb_invalidate>
    }
}
c0103f15:	90                   	nop
c0103f16:	c9                   	leave  
c0103f17:	c3                   	ret    

c0103f18 <page_remove>:

//page_remove - free an Page which is related linear address la and has an validated pte
void
page_remove(pde_t *pgdir, uintptr_t la) {
c0103f18:	f3 0f 1e fb          	endbr32 
c0103f1c:	55                   	push   %ebp
c0103f1d:	89 e5                	mov    %esp,%ebp
c0103f1f:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c0103f22:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0103f29:	00 
c0103f2a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103f2d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103f31:	8b 45 08             	mov    0x8(%ebp),%eax
c0103f34:	89 04 24             	mov    %eax,(%esp)
c0103f37:	e8 db fd ff ff       	call   c0103d17 <get_pte>
c0103f3c:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep != NULL) {
c0103f3f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103f43:	74 19                	je     c0103f5e <page_remove+0x46>
        page_remove_pte(pgdir, la, ptep);
c0103f45:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103f48:	89 44 24 08          	mov    %eax,0x8(%esp)
c0103f4c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103f4f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103f53:	8b 45 08             	mov    0x8(%ebp),%eax
c0103f56:	89 04 24             	mov    %eax,(%esp)
c0103f59:	e8 53 ff ff ff       	call   c0103eb1 <page_remove_pte>
    }
}
c0103f5e:	90                   	nop
c0103f5f:	c9                   	leave  
c0103f60:	c3                   	ret    

c0103f61 <page_insert>:
//  la:    the linear address need to map
//  perm:  the permission of this Page which is setted in related pte
// return value: always 0
//note: PT is changed, so the TLB need to be invalidate 
int
page_insert(pde_t *pgdir, struct Page *page, uintptr_t la, uint32_t perm) {
c0103f61:	f3 0f 1e fb          	endbr32 
c0103f65:	55                   	push   %ebp
c0103f66:	89 e5                	mov    %esp,%ebp
c0103f68:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 1);
c0103f6b:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0103f72:	00 
c0103f73:	8b 45 10             	mov    0x10(%ebp),%eax
c0103f76:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103f7a:	8b 45 08             	mov    0x8(%ebp),%eax
c0103f7d:	89 04 24             	mov    %eax,(%esp)
c0103f80:	e8 92 fd ff ff       	call   c0103d17 <get_pte>
c0103f85:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep == NULL) {
c0103f88:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103f8c:	75 0a                	jne    c0103f98 <page_insert+0x37>
        return -E_NO_MEM;
c0103f8e:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c0103f93:	e9 84 00 00 00       	jmp    c010401c <page_insert+0xbb>
    }
    page_ref_inc(page);
c0103f98:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103f9b:	89 04 24             	mov    %eax,(%esp)
c0103f9e:	e8 a6 f4 ff ff       	call   c0103449 <page_ref_inc>
    if (*ptep & PTE_P) {
c0103fa3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103fa6:	8b 00                	mov    (%eax),%eax
c0103fa8:	83 e0 01             	and    $0x1,%eax
c0103fab:	85 c0                	test   %eax,%eax
c0103fad:	74 3e                	je     c0103fed <page_insert+0x8c>
        struct Page *p = pte2page(*ptep);
c0103faf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103fb2:	8b 00                	mov    (%eax),%eax
c0103fb4:	89 04 24             	mov    %eax,(%esp)
c0103fb7:	e8 1f f4 ff ff       	call   c01033db <pte2page>
c0103fbc:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (p == page) {
c0103fbf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103fc2:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0103fc5:	75 0d                	jne    c0103fd4 <page_insert+0x73>
            page_ref_dec(page);
c0103fc7:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103fca:	89 04 24             	mov    %eax,(%esp)
c0103fcd:	e8 8e f4 ff ff       	call   c0103460 <page_ref_dec>
c0103fd2:	eb 19                	jmp    c0103fed <page_insert+0x8c>
        }
        else {
            page_remove_pte(pgdir, la, ptep);
c0103fd4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103fd7:	89 44 24 08          	mov    %eax,0x8(%esp)
c0103fdb:	8b 45 10             	mov    0x10(%ebp),%eax
c0103fde:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103fe2:	8b 45 08             	mov    0x8(%ebp),%eax
c0103fe5:	89 04 24             	mov    %eax,(%esp)
c0103fe8:	e8 c4 fe ff ff       	call   c0103eb1 <page_remove_pte>
        }
    }
    *ptep = page2pa(page) | PTE_P | perm;
c0103fed:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103ff0:	89 04 24             	mov    %eax,(%esp)
c0103ff3:	e8 34 f3 ff ff       	call   c010332c <page2pa>
c0103ff8:	0b 45 14             	or     0x14(%ebp),%eax
c0103ffb:	83 c8 01             	or     $0x1,%eax
c0103ffe:	89 c2                	mov    %eax,%edx
c0104000:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104003:	89 10                	mov    %edx,(%eax)
    tlb_invalidate(pgdir, la);
c0104005:	8b 45 10             	mov    0x10(%ebp),%eax
c0104008:	89 44 24 04          	mov    %eax,0x4(%esp)
c010400c:	8b 45 08             	mov    0x8(%ebp),%eax
c010400f:	89 04 24             	mov    %eax,(%esp)
c0104012:	e8 07 00 00 00       	call   c010401e <tlb_invalidate>
    return 0;
c0104017:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010401c:	c9                   	leave  
c010401d:	c3                   	ret    

c010401e <tlb_invalidate>:

// invalidate a TLB entry, but only if the page tables being
// edited are the ones currently in use by the processor.
void
tlb_invalidate(pde_t *pgdir, uintptr_t la) {
c010401e:	f3 0f 1e fb          	endbr32 
c0104022:	55                   	push   %ebp
c0104023:	89 e5                	mov    %esp,%ebp
c0104025:	83 ec 28             	sub    $0x28,%esp
}

static inline uintptr_t
rcr3(void) {
    uintptr_t cr3;
    asm volatile ("mov %%cr3, %0" : "=r" (cr3) :: "memory");
c0104028:	0f 20 d8             	mov    %cr3,%eax
c010402b:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return cr3;
c010402e:	8b 55 f0             	mov    -0x10(%ebp),%edx
    if (rcr3() == PADDR(pgdir)) {
c0104031:	8b 45 08             	mov    0x8(%ebp),%eax
c0104034:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104037:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c010403e:	77 23                	ja     c0104063 <tlb_invalidate+0x45>
c0104040:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104043:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104047:	c7 44 24 08 84 aa 10 	movl   $0xc010aa84,0x8(%esp)
c010404e:	c0 
c010404f:	c7 44 24 04 d0 01 00 	movl   $0x1d0,0x4(%esp)
c0104056:	00 
c0104057:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c010405e:	e8 da c3 ff ff       	call   c010043d <__panic>
c0104063:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104066:	05 00 00 00 40       	add    $0x40000000,%eax
c010406b:	39 d0                	cmp    %edx,%eax
c010406d:	75 0d                	jne    c010407c <tlb_invalidate+0x5e>
        invlpg((void *)la);
c010406f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104072:	89 45 ec             	mov    %eax,-0x14(%ebp)
}

static inline void
invlpg(void *addr) {
    asm volatile ("invlpg (%0)" :: "r" (addr) : "memory");
c0104075:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104078:	0f 01 38             	invlpg (%eax)
}
c010407b:	90                   	nop
    }
}
c010407c:	90                   	nop
c010407d:	c9                   	leave  
c010407e:	c3                   	ret    

c010407f <pgdir_alloc_page>:

// pgdir_alloc_page - call alloc_page & page_insert functions to 
//                  - allocate a page size memory & setup an addr map
//                  - pa<->la with linear address la and the PDT pgdir
struct Page *
pgdir_alloc_page(pde_t *pgdir, uintptr_t la, uint32_t perm) {
c010407f:	f3 0f 1e fb          	endbr32 
c0104083:	55                   	push   %ebp
c0104084:	89 e5                	mov    %esp,%ebp
c0104086:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_page();
c0104089:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104090:	e8 b2 f5 ff ff       	call   c0103647 <alloc_pages>
c0104095:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c0104098:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010409c:	0f 84 a7 00 00 00    	je     c0104149 <pgdir_alloc_page+0xca>
        if (page_insert(pgdir, page, la, perm) != 0) {
c01040a2:	8b 45 10             	mov    0x10(%ebp),%eax
c01040a5:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01040a9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01040ac:	89 44 24 08          	mov    %eax,0x8(%esp)
c01040b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01040b3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01040b7:	8b 45 08             	mov    0x8(%ebp),%eax
c01040ba:	89 04 24             	mov    %eax,(%esp)
c01040bd:	e8 9f fe ff ff       	call   c0103f61 <page_insert>
c01040c2:	85 c0                	test   %eax,%eax
c01040c4:	74 1a                	je     c01040e0 <pgdir_alloc_page+0x61>
            free_page(page);
c01040c6:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01040cd:	00 
c01040ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01040d1:	89 04 24             	mov    %eax,(%esp)
c01040d4:	e8 dd f5 ff ff       	call   c01036b6 <free_pages>
            return NULL;
c01040d9:	b8 00 00 00 00       	mov    $0x0,%eax
c01040de:	eb 6c                	jmp    c010414c <pgdir_alloc_page+0xcd>
        }
        if (swap_init_ok){
c01040e0:	a1 14 c0 12 c0       	mov    0xc012c014,%eax
c01040e5:	85 c0                	test   %eax,%eax
c01040e7:	74 60                	je     c0104149 <pgdir_alloc_page+0xca>
            swap_map_swappable(check_mm_struct, la, page, 0);
c01040e9:	a1 6c e0 12 c0       	mov    0xc012e06c,%eax
c01040ee:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c01040f5:	00 
c01040f6:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01040f9:	89 54 24 08          	mov    %edx,0x8(%esp)
c01040fd:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104100:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104104:	89 04 24             	mov    %eax,(%esp)
c0104107:	e8 04 28 00 00       	call   c0106910 <swap_map_swappable>
            page->pra_vaddr=la;
c010410c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010410f:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104112:	89 50 1c             	mov    %edx,0x1c(%eax)
            assert(page_ref(page) == 1);
c0104115:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104118:	89 04 24             	mov    %eax,(%esp)
c010411b:	e8 11 f3 ff ff       	call   c0103431 <page_ref>
c0104120:	83 f8 01             	cmp    $0x1,%eax
c0104123:	74 24                	je     c0104149 <pgdir_alloc_page+0xca>
c0104125:	c7 44 24 0c 08 ab 10 	movl   $0xc010ab08,0xc(%esp)
c010412c:	c0 
c010412d:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104134:	c0 
c0104135:	c7 44 24 04 e3 01 00 	movl   $0x1e3,0x4(%esp)
c010413c:	00 
c010413d:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104144:	e8 f4 c2 ff ff       	call   c010043d <__panic>
            //cprintf("get No. %d  page: pra_vaddr %x, pra_link.prev %x, pra_link_next %x in pgdir_alloc_page\n", (page-pages), page->pra_vaddr,page->pra_page_link.prev, page->pra_page_link.next);
        }

    }

    return page;
c0104149:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010414c:	c9                   	leave  
c010414d:	c3                   	ret    

c010414e <check_alloc_page>:

static void
check_alloc_page(void) {
c010414e:	f3 0f 1e fb          	endbr32 
c0104152:	55                   	push   %ebp
c0104153:	89 e5                	mov    %esp,%ebp
c0104155:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->check();
c0104158:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c010415d:	8b 40 18             	mov    0x18(%eax),%eax
c0104160:	ff d0                	call   *%eax
    cprintf("check_alloc_page() succeeded!\n");
c0104162:	c7 04 24 1c ab 10 c0 	movl   $0xc010ab1c,(%esp)
c0104169:	e8 63 c1 ff ff       	call   c01002d1 <cprintf>
}
c010416e:	90                   	nop
c010416f:	c9                   	leave  
c0104170:	c3                   	ret    

c0104171 <check_pgdir>:

static void
check_pgdir(void) {
c0104171:	f3 0f 1e fb          	endbr32 
c0104175:	55                   	push   %ebp
c0104176:	89 e5                	mov    %esp,%ebp
c0104178:	83 ec 38             	sub    $0x38,%esp
    assert(npage <= KMEMSIZE / PGSIZE);
c010417b:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0104180:	3d 00 80 03 00       	cmp    $0x38000,%eax
c0104185:	76 24                	jbe    c01041ab <check_pgdir+0x3a>
c0104187:	c7 44 24 0c 3b ab 10 	movl   $0xc010ab3b,0xc(%esp)
c010418e:	c0 
c010418f:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104196:	c0 
c0104197:	c7 44 24 04 f4 01 00 	movl   $0x1f4,0x4(%esp)
c010419e:	00 
c010419f:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01041a6:	e8 92 c2 ff ff       	call   c010043d <__panic>
    assert(boot_pgdir != NULL && (uint32_t)PGOFF(boot_pgdir) == 0);
c01041ab:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01041b0:	85 c0                	test   %eax,%eax
c01041b2:	74 0e                	je     c01041c2 <check_pgdir+0x51>
c01041b4:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01041b9:	25 ff 0f 00 00       	and    $0xfff,%eax
c01041be:	85 c0                	test   %eax,%eax
c01041c0:	74 24                	je     c01041e6 <check_pgdir+0x75>
c01041c2:	c7 44 24 0c 58 ab 10 	movl   $0xc010ab58,0xc(%esp)
c01041c9:	c0 
c01041ca:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01041d1:	c0 
c01041d2:	c7 44 24 04 f5 01 00 	movl   $0x1f5,0x4(%esp)
c01041d9:	00 
c01041da:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01041e1:	e8 57 c2 ff ff       	call   c010043d <__panic>
    assert(get_page(boot_pgdir, 0x0, NULL) == NULL);
c01041e6:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01041eb:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01041f2:	00 
c01041f3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01041fa:	00 
c01041fb:	89 04 24             	mov    %eax,(%esp)
c01041fe:	e8 51 fc ff ff       	call   c0103e54 <get_page>
c0104203:	85 c0                	test   %eax,%eax
c0104205:	74 24                	je     c010422b <check_pgdir+0xba>
c0104207:	c7 44 24 0c 90 ab 10 	movl   $0xc010ab90,0xc(%esp)
c010420e:	c0 
c010420f:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104216:	c0 
c0104217:	c7 44 24 04 f6 01 00 	movl   $0x1f6,0x4(%esp)
c010421e:	00 
c010421f:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104226:	e8 12 c2 ff ff       	call   c010043d <__panic>

    struct Page *p1, *p2;
    p1 = alloc_page();
c010422b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104232:	e8 10 f4 ff ff       	call   c0103647 <alloc_pages>
c0104237:	89 45 f4             	mov    %eax,-0xc(%ebp)
    assert(page_insert(boot_pgdir, p1, 0x0, 0) == 0);
c010423a:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c010423f:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0104246:	00 
c0104247:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010424e:	00 
c010424f:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0104252:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104256:	89 04 24             	mov    %eax,(%esp)
c0104259:	e8 03 fd ff ff       	call   c0103f61 <page_insert>
c010425e:	85 c0                	test   %eax,%eax
c0104260:	74 24                	je     c0104286 <check_pgdir+0x115>
c0104262:	c7 44 24 0c b8 ab 10 	movl   $0xc010abb8,0xc(%esp)
c0104269:	c0 
c010426a:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104271:	c0 
c0104272:	c7 44 24 04 fa 01 00 	movl   $0x1fa,0x4(%esp)
c0104279:	00 
c010427a:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104281:	e8 b7 c1 ff ff       	call   c010043d <__panic>

    pte_t *ptep;
    assert((ptep = get_pte(boot_pgdir, 0x0, 0)) != NULL);
c0104286:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c010428b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104292:	00 
c0104293:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010429a:	00 
c010429b:	89 04 24             	mov    %eax,(%esp)
c010429e:	e8 74 fa ff ff       	call   c0103d17 <get_pte>
c01042a3:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01042a6:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01042aa:	75 24                	jne    c01042d0 <check_pgdir+0x15f>
c01042ac:	c7 44 24 0c e4 ab 10 	movl   $0xc010abe4,0xc(%esp)
c01042b3:	c0 
c01042b4:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01042bb:	c0 
c01042bc:	c7 44 24 04 fd 01 00 	movl   $0x1fd,0x4(%esp)
c01042c3:	00 
c01042c4:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01042cb:	e8 6d c1 ff ff       	call   c010043d <__panic>
    assert(pte2page(*ptep) == p1);
c01042d0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01042d3:	8b 00                	mov    (%eax),%eax
c01042d5:	89 04 24             	mov    %eax,(%esp)
c01042d8:	e8 fe f0 ff ff       	call   c01033db <pte2page>
c01042dd:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c01042e0:	74 24                	je     c0104306 <check_pgdir+0x195>
c01042e2:	c7 44 24 0c 11 ac 10 	movl   $0xc010ac11,0xc(%esp)
c01042e9:	c0 
c01042ea:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01042f1:	c0 
c01042f2:	c7 44 24 04 fe 01 00 	movl   $0x1fe,0x4(%esp)
c01042f9:	00 
c01042fa:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104301:	e8 37 c1 ff ff       	call   c010043d <__panic>
    assert(page_ref(p1) == 1);
c0104306:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104309:	89 04 24             	mov    %eax,(%esp)
c010430c:	e8 20 f1 ff ff       	call   c0103431 <page_ref>
c0104311:	83 f8 01             	cmp    $0x1,%eax
c0104314:	74 24                	je     c010433a <check_pgdir+0x1c9>
c0104316:	c7 44 24 0c 27 ac 10 	movl   $0xc010ac27,0xc(%esp)
c010431d:	c0 
c010431e:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104325:	c0 
c0104326:	c7 44 24 04 ff 01 00 	movl   $0x1ff,0x4(%esp)
c010432d:	00 
c010432e:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104335:	e8 03 c1 ff ff       	call   c010043d <__panic>

    ptep = &((pte_t *)KADDR(PDE_ADDR(boot_pgdir[0])))[1];
c010433a:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c010433f:	8b 00                	mov    (%eax),%eax
c0104341:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104346:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0104349:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010434c:	c1 e8 0c             	shr    $0xc,%eax
c010434f:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0104352:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0104357:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c010435a:	72 23                	jb     c010437f <check_pgdir+0x20e>
c010435c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010435f:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104363:	c7 44 24 08 e0 a9 10 	movl   $0xc010a9e0,0x8(%esp)
c010436a:	c0 
c010436b:	c7 44 24 04 01 02 00 	movl   $0x201,0x4(%esp)
c0104372:	00 
c0104373:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c010437a:	e8 be c0 ff ff       	call   c010043d <__panic>
c010437f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104382:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0104387:	83 c0 04             	add    $0x4,%eax
c010438a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    assert(get_pte(boot_pgdir, PGSIZE, 0) == ptep);
c010438d:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104392:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104399:	00 
c010439a:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c01043a1:	00 
c01043a2:	89 04 24             	mov    %eax,(%esp)
c01043a5:	e8 6d f9 ff ff       	call   c0103d17 <get_pte>
c01043aa:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01043ad:	74 24                	je     c01043d3 <check_pgdir+0x262>
c01043af:	c7 44 24 0c 3c ac 10 	movl   $0xc010ac3c,0xc(%esp)
c01043b6:	c0 
c01043b7:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01043be:	c0 
c01043bf:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
c01043c6:	00 
c01043c7:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01043ce:	e8 6a c0 ff ff       	call   c010043d <__panic>

    p2 = alloc_page();
c01043d3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01043da:	e8 68 f2 ff ff       	call   c0103647 <alloc_pages>
c01043df:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(page_insert(boot_pgdir, p2, PGSIZE, PTE_U | PTE_W) == 0);
c01043e2:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01043e7:	c7 44 24 0c 06 00 00 	movl   $0x6,0xc(%esp)
c01043ee:	00 
c01043ef:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c01043f6:	00 
c01043f7:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01043fa:	89 54 24 04          	mov    %edx,0x4(%esp)
c01043fe:	89 04 24             	mov    %eax,(%esp)
c0104401:	e8 5b fb ff ff       	call   c0103f61 <page_insert>
c0104406:	85 c0                	test   %eax,%eax
c0104408:	74 24                	je     c010442e <check_pgdir+0x2bd>
c010440a:	c7 44 24 0c 64 ac 10 	movl   $0xc010ac64,0xc(%esp)
c0104411:	c0 
c0104412:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104419:	c0 
c010441a:	c7 44 24 04 05 02 00 	movl   $0x205,0x4(%esp)
c0104421:	00 
c0104422:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104429:	e8 0f c0 ff ff       	call   c010043d <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c010442e:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104433:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010443a:	00 
c010443b:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0104442:	00 
c0104443:	89 04 24             	mov    %eax,(%esp)
c0104446:	e8 cc f8 ff ff       	call   c0103d17 <get_pte>
c010444b:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010444e:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104452:	75 24                	jne    c0104478 <check_pgdir+0x307>
c0104454:	c7 44 24 0c 9c ac 10 	movl   $0xc010ac9c,0xc(%esp)
c010445b:	c0 
c010445c:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104463:	c0 
c0104464:	c7 44 24 04 06 02 00 	movl   $0x206,0x4(%esp)
c010446b:	00 
c010446c:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104473:	e8 c5 bf ff ff       	call   c010043d <__panic>
    assert(*ptep & PTE_U);
c0104478:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010447b:	8b 00                	mov    (%eax),%eax
c010447d:	83 e0 04             	and    $0x4,%eax
c0104480:	85 c0                	test   %eax,%eax
c0104482:	75 24                	jne    c01044a8 <check_pgdir+0x337>
c0104484:	c7 44 24 0c cc ac 10 	movl   $0xc010accc,0xc(%esp)
c010448b:	c0 
c010448c:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104493:	c0 
c0104494:	c7 44 24 04 07 02 00 	movl   $0x207,0x4(%esp)
c010449b:	00 
c010449c:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01044a3:	e8 95 bf ff ff       	call   c010043d <__panic>
    assert(*ptep & PTE_W);
c01044a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01044ab:	8b 00                	mov    (%eax),%eax
c01044ad:	83 e0 02             	and    $0x2,%eax
c01044b0:	85 c0                	test   %eax,%eax
c01044b2:	75 24                	jne    c01044d8 <check_pgdir+0x367>
c01044b4:	c7 44 24 0c da ac 10 	movl   $0xc010acda,0xc(%esp)
c01044bb:	c0 
c01044bc:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01044c3:	c0 
c01044c4:	c7 44 24 04 08 02 00 	movl   $0x208,0x4(%esp)
c01044cb:	00 
c01044cc:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01044d3:	e8 65 bf ff ff       	call   c010043d <__panic>
    assert(boot_pgdir[0] & PTE_U);
c01044d8:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01044dd:	8b 00                	mov    (%eax),%eax
c01044df:	83 e0 04             	and    $0x4,%eax
c01044e2:	85 c0                	test   %eax,%eax
c01044e4:	75 24                	jne    c010450a <check_pgdir+0x399>
c01044e6:	c7 44 24 0c e8 ac 10 	movl   $0xc010ace8,0xc(%esp)
c01044ed:	c0 
c01044ee:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01044f5:	c0 
c01044f6:	c7 44 24 04 09 02 00 	movl   $0x209,0x4(%esp)
c01044fd:	00 
c01044fe:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104505:	e8 33 bf ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 1);
c010450a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010450d:	89 04 24             	mov    %eax,(%esp)
c0104510:	e8 1c ef ff ff       	call   c0103431 <page_ref>
c0104515:	83 f8 01             	cmp    $0x1,%eax
c0104518:	74 24                	je     c010453e <check_pgdir+0x3cd>
c010451a:	c7 44 24 0c fe ac 10 	movl   $0xc010acfe,0xc(%esp)
c0104521:	c0 
c0104522:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104529:	c0 
c010452a:	c7 44 24 04 0a 02 00 	movl   $0x20a,0x4(%esp)
c0104531:	00 
c0104532:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104539:	e8 ff be ff ff       	call   c010043d <__panic>

    assert(page_insert(boot_pgdir, p1, PGSIZE, 0) == 0);
c010453e:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104543:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c010454a:	00 
c010454b:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0104552:	00 
c0104553:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0104556:	89 54 24 04          	mov    %edx,0x4(%esp)
c010455a:	89 04 24             	mov    %eax,(%esp)
c010455d:	e8 ff f9 ff ff       	call   c0103f61 <page_insert>
c0104562:	85 c0                	test   %eax,%eax
c0104564:	74 24                	je     c010458a <check_pgdir+0x419>
c0104566:	c7 44 24 0c 10 ad 10 	movl   $0xc010ad10,0xc(%esp)
c010456d:	c0 
c010456e:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104575:	c0 
c0104576:	c7 44 24 04 0c 02 00 	movl   $0x20c,0x4(%esp)
c010457d:	00 
c010457e:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104585:	e8 b3 be ff ff       	call   c010043d <__panic>
    assert(page_ref(p1) == 2);
c010458a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010458d:	89 04 24             	mov    %eax,(%esp)
c0104590:	e8 9c ee ff ff       	call   c0103431 <page_ref>
c0104595:	83 f8 02             	cmp    $0x2,%eax
c0104598:	74 24                	je     c01045be <check_pgdir+0x44d>
c010459a:	c7 44 24 0c 3c ad 10 	movl   $0xc010ad3c,0xc(%esp)
c01045a1:	c0 
c01045a2:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01045a9:	c0 
c01045aa:	c7 44 24 04 0d 02 00 	movl   $0x20d,0x4(%esp)
c01045b1:	00 
c01045b2:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01045b9:	e8 7f be ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c01045be:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01045c1:	89 04 24             	mov    %eax,(%esp)
c01045c4:	e8 68 ee ff ff       	call   c0103431 <page_ref>
c01045c9:	85 c0                	test   %eax,%eax
c01045cb:	74 24                	je     c01045f1 <check_pgdir+0x480>
c01045cd:	c7 44 24 0c 4e ad 10 	movl   $0xc010ad4e,0xc(%esp)
c01045d4:	c0 
c01045d5:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01045dc:	c0 
c01045dd:	c7 44 24 04 0e 02 00 	movl   $0x20e,0x4(%esp)
c01045e4:	00 
c01045e5:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01045ec:	e8 4c be ff ff       	call   c010043d <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c01045f1:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01045f6:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01045fd:	00 
c01045fe:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0104605:	00 
c0104606:	89 04 24             	mov    %eax,(%esp)
c0104609:	e8 09 f7 ff ff       	call   c0103d17 <get_pte>
c010460e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104611:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104615:	75 24                	jne    c010463b <check_pgdir+0x4ca>
c0104617:	c7 44 24 0c 9c ac 10 	movl   $0xc010ac9c,0xc(%esp)
c010461e:	c0 
c010461f:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104626:	c0 
c0104627:	c7 44 24 04 0f 02 00 	movl   $0x20f,0x4(%esp)
c010462e:	00 
c010462f:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104636:	e8 02 be ff ff       	call   c010043d <__panic>
    assert(pte2page(*ptep) == p1);
c010463b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010463e:	8b 00                	mov    (%eax),%eax
c0104640:	89 04 24             	mov    %eax,(%esp)
c0104643:	e8 93 ed ff ff       	call   c01033db <pte2page>
c0104648:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c010464b:	74 24                	je     c0104671 <check_pgdir+0x500>
c010464d:	c7 44 24 0c 11 ac 10 	movl   $0xc010ac11,0xc(%esp)
c0104654:	c0 
c0104655:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c010465c:	c0 
c010465d:	c7 44 24 04 10 02 00 	movl   $0x210,0x4(%esp)
c0104664:	00 
c0104665:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c010466c:	e8 cc bd ff ff       	call   c010043d <__panic>
    assert((*ptep & PTE_U) == 0);
c0104671:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104674:	8b 00                	mov    (%eax),%eax
c0104676:	83 e0 04             	and    $0x4,%eax
c0104679:	85 c0                	test   %eax,%eax
c010467b:	74 24                	je     c01046a1 <check_pgdir+0x530>
c010467d:	c7 44 24 0c 60 ad 10 	movl   $0xc010ad60,0xc(%esp)
c0104684:	c0 
c0104685:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c010468c:	c0 
c010468d:	c7 44 24 04 11 02 00 	movl   $0x211,0x4(%esp)
c0104694:	00 
c0104695:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c010469c:	e8 9c bd ff ff       	call   c010043d <__panic>

    page_remove(boot_pgdir, 0x0);
c01046a1:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01046a6:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01046ad:	00 
c01046ae:	89 04 24             	mov    %eax,(%esp)
c01046b1:	e8 62 f8 ff ff       	call   c0103f18 <page_remove>
    assert(page_ref(p1) == 1);
c01046b6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01046b9:	89 04 24             	mov    %eax,(%esp)
c01046bc:	e8 70 ed ff ff       	call   c0103431 <page_ref>
c01046c1:	83 f8 01             	cmp    $0x1,%eax
c01046c4:	74 24                	je     c01046ea <check_pgdir+0x579>
c01046c6:	c7 44 24 0c 27 ac 10 	movl   $0xc010ac27,0xc(%esp)
c01046cd:	c0 
c01046ce:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01046d5:	c0 
c01046d6:	c7 44 24 04 14 02 00 	movl   $0x214,0x4(%esp)
c01046dd:	00 
c01046de:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01046e5:	e8 53 bd ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c01046ea:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01046ed:	89 04 24             	mov    %eax,(%esp)
c01046f0:	e8 3c ed ff ff       	call   c0103431 <page_ref>
c01046f5:	85 c0                	test   %eax,%eax
c01046f7:	74 24                	je     c010471d <check_pgdir+0x5ac>
c01046f9:	c7 44 24 0c 4e ad 10 	movl   $0xc010ad4e,0xc(%esp)
c0104700:	c0 
c0104701:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104708:	c0 
c0104709:	c7 44 24 04 15 02 00 	movl   $0x215,0x4(%esp)
c0104710:	00 
c0104711:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104718:	e8 20 bd ff ff       	call   c010043d <__panic>

    page_remove(boot_pgdir, PGSIZE);
c010471d:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104722:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0104729:	00 
c010472a:	89 04 24             	mov    %eax,(%esp)
c010472d:	e8 e6 f7 ff ff       	call   c0103f18 <page_remove>
    assert(page_ref(p1) == 0);
c0104732:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104735:	89 04 24             	mov    %eax,(%esp)
c0104738:	e8 f4 ec ff ff       	call   c0103431 <page_ref>
c010473d:	85 c0                	test   %eax,%eax
c010473f:	74 24                	je     c0104765 <check_pgdir+0x5f4>
c0104741:	c7 44 24 0c 75 ad 10 	movl   $0xc010ad75,0xc(%esp)
c0104748:	c0 
c0104749:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104750:	c0 
c0104751:	c7 44 24 04 18 02 00 	movl   $0x218,0x4(%esp)
c0104758:	00 
c0104759:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104760:	e8 d8 bc ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c0104765:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104768:	89 04 24             	mov    %eax,(%esp)
c010476b:	e8 c1 ec ff ff       	call   c0103431 <page_ref>
c0104770:	85 c0                	test   %eax,%eax
c0104772:	74 24                	je     c0104798 <check_pgdir+0x627>
c0104774:	c7 44 24 0c 4e ad 10 	movl   $0xc010ad4e,0xc(%esp)
c010477b:	c0 
c010477c:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104783:	c0 
c0104784:	c7 44 24 04 19 02 00 	movl   $0x219,0x4(%esp)
c010478b:	00 
c010478c:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104793:	e8 a5 bc ff ff       	call   c010043d <__panic>

    assert(page_ref(pde2page(boot_pgdir[0])) == 1);
c0104798:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c010479d:	8b 00                	mov    (%eax),%eax
c010479f:	89 04 24             	mov    %eax,(%esp)
c01047a2:	e8 72 ec ff ff       	call   c0103419 <pde2page>
c01047a7:	89 04 24             	mov    %eax,(%esp)
c01047aa:	e8 82 ec ff ff       	call   c0103431 <page_ref>
c01047af:	83 f8 01             	cmp    $0x1,%eax
c01047b2:	74 24                	je     c01047d8 <check_pgdir+0x667>
c01047b4:	c7 44 24 0c 88 ad 10 	movl   $0xc010ad88,0xc(%esp)
c01047bb:	c0 
c01047bc:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01047c3:	c0 
c01047c4:	c7 44 24 04 1b 02 00 	movl   $0x21b,0x4(%esp)
c01047cb:	00 
c01047cc:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01047d3:	e8 65 bc ff ff       	call   c010043d <__panic>
    free_page(pde2page(boot_pgdir[0]));
c01047d8:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01047dd:	8b 00                	mov    (%eax),%eax
c01047df:	89 04 24             	mov    %eax,(%esp)
c01047e2:	e8 32 ec ff ff       	call   c0103419 <pde2page>
c01047e7:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01047ee:	00 
c01047ef:	89 04 24             	mov    %eax,(%esp)
c01047f2:	e8 bf ee ff ff       	call   c01036b6 <free_pages>
    boot_pgdir[0] = 0;
c01047f7:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01047fc:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_pgdir() succeeded!\n");
c0104802:	c7 04 24 af ad 10 c0 	movl   $0xc010adaf,(%esp)
c0104809:	e8 c3 ba ff ff       	call   c01002d1 <cprintf>
}
c010480e:	90                   	nop
c010480f:	c9                   	leave  
c0104810:	c3                   	ret    

c0104811 <check_boot_pgdir>:

static void
check_boot_pgdir(void) {
c0104811:	f3 0f 1e fb          	endbr32 
c0104815:	55                   	push   %ebp
c0104816:	89 e5                	mov    %esp,%ebp
c0104818:	83 ec 38             	sub    $0x38,%esp
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c010481b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0104822:	e9 ca 00 00 00       	jmp    c01048f1 <check_boot_pgdir+0xe0>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
c0104827:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010482a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010482d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104830:	c1 e8 0c             	shr    $0xc,%eax
c0104833:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0104836:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c010483b:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c010483e:	72 23                	jb     c0104863 <check_boot_pgdir+0x52>
c0104840:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104843:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104847:	c7 44 24 08 e0 a9 10 	movl   $0xc010a9e0,0x8(%esp)
c010484e:	c0 
c010484f:	c7 44 24 04 27 02 00 	movl   $0x227,0x4(%esp)
c0104856:	00 
c0104857:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c010485e:	e8 da bb ff ff       	call   c010043d <__panic>
c0104863:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104866:	2d 00 00 00 40       	sub    $0x40000000,%eax
c010486b:	89 c2                	mov    %eax,%edx
c010486d:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104872:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104879:	00 
c010487a:	89 54 24 04          	mov    %edx,0x4(%esp)
c010487e:	89 04 24             	mov    %eax,(%esp)
c0104881:	e8 91 f4 ff ff       	call   c0103d17 <get_pte>
c0104886:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0104889:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c010488d:	75 24                	jne    c01048b3 <check_boot_pgdir+0xa2>
c010488f:	c7 44 24 0c cc ad 10 	movl   $0xc010adcc,0xc(%esp)
c0104896:	c0 
c0104897:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c010489e:	c0 
c010489f:	c7 44 24 04 27 02 00 	movl   $0x227,0x4(%esp)
c01048a6:	00 
c01048a7:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01048ae:	e8 8a bb ff ff       	call   c010043d <__panic>
        assert(PTE_ADDR(*ptep) == i);
c01048b3:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01048b6:	8b 00                	mov    (%eax),%eax
c01048b8:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01048bd:	89 c2                	mov    %eax,%edx
c01048bf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01048c2:	39 c2                	cmp    %eax,%edx
c01048c4:	74 24                	je     c01048ea <check_boot_pgdir+0xd9>
c01048c6:	c7 44 24 0c 09 ae 10 	movl   $0xc010ae09,0xc(%esp)
c01048cd:	c0 
c01048ce:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01048d5:	c0 
c01048d6:	c7 44 24 04 28 02 00 	movl   $0x228,0x4(%esp)
c01048dd:	00 
c01048de:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01048e5:	e8 53 bb ff ff       	call   c010043d <__panic>
    for (i = 0; i < npage; i += PGSIZE) {
c01048ea:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
c01048f1:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01048f4:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c01048f9:	39 c2                	cmp    %eax,%edx
c01048fb:	0f 82 26 ff ff ff    	jb     c0104827 <check_boot_pgdir+0x16>
    }

    assert(PDE_ADDR(boot_pgdir[PDX(VPT)]) == PADDR(boot_pgdir));
c0104901:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104906:	05 ac 0f 00 00       	add    $0xfac,%eax
c010490b:	8b 00                	mov    (%eax),%eax
c010490d:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104912:	89 c2                	mov    %eax,%edx
c0104914:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104919:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010491c:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c0104923:	77 23                	ja     c0104948 <check_boot_pgdir+0x137>
c0104925:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104928:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010492c:	c7 44 24 08 84 aa 10 	movl   $0xc010aa84,0x8(%esp)
c0104933:	c0 
c0104934:	c7 44 24 04 2b 02 00 	movl   $0x22b,0x4(%esp)
c010493b:	00 
c010493c:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104943:	e8 f5 ba ff ff       	call   c010043d <__panic>
c0104948:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010494b:	05 00 00 00 40       	add    $0x40000000,%eax
c0104950:	39 d0                	cmp    %edx,%eax
c0104952:	74 24                	je     c0104978 <check_boot_pgdir+0x167>
c0104954:	c7 44 24 0c 20 ae 10 	movl   $0xc010ae20,0xc(%esp)
c010495b:	c0 
c010495c:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104963:	c0 
c0104964:	c7 44 24 04 2b 02 00 	movl   $0x22b,0x4(%esp)
c010496b:	00 
c010496c:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104973:	e8 c5 ba ff ff       	call   c010043d <__panic>

    assert(boot_pgdir[0] == 0);
c0104978:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c010497d:	8b 00                	mov    (%eax),%eax
c010497f:	85 c0                	test   %eax,%eax
c0104981:	74 24                	je     c01049a7 <check_boot_pgdir+0x196>
c0104983:	c7 44 24 0c 54 ae 10 	movl   $0xc010ae54,0xc(%esp)
c010498a:	c0 
c010498b:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104992:	c0 
c0104993:	c7 44 24 04 2d 02 00 	movl   $0x22d,0x4(%esp)
c010499a:	00 
c010499b:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01049a2:	e8 96 ba ff ff       	call   c010043d <__panic>

    struct Page *p;
    p = alloc_page();
c01049a7:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01049ae:	e8 94 ec ff ff       	call   c0103647 <alloc_pages>
c01049b3:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert(page_insert(boot_pgdir, p, 0x100, PTE_W) == 0);
c01049b6:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c01049bb:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c01049c2:	00 
c01049c3:	c7 44 24 08 00 01 00 	movl   $0x100,0x8(%esp)
c01049ca:	00 
c01049cb:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01049ce:	89 54 24 04          	mov    %edx,0x4(%esp)
c01049d2:	89 04 24             	mov    %eax,(%esp)
c01049d5:	e8 87 f5 ff ff       	call   c0103f61 <page_insert>
c01049da:	85 c0                	test   %eax,%eax
c01049dc:	74 24                	je     c0104a02 <check_boot_pgdir+0x1f1>
c01049de:	c7 44 24 0c 68 ae 10 	movl   $0xc010ae68,0xc(%esp)
c01049e5:	c0 
c01049e6:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c01049ed:	c0 
c01049ee:	c7 44 24 04 31 02 00 	movl   $0x231,0x4(%esp)
c01049f5:	00 
c01049f6:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c01049fd:	e8 3b ba ff ff       	call   c010043d <__panic>
    assert(page_ref(p) == 1);
c0104a02:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104a05:	89 04 24             	mov    %eax,(%esp)
c0104a08:	e8 24 ea ff ff       	call   c0103431 <page_ref>
c0104a0d:	83 f8 01             	cmp    $0x1,%eax
c0104a10:	74 24                	je     c0104a36 <check_boot_pgdir+0x225>
c0104a12:	c7 44 24 0c 96 ae 10 	movl   $0xc010ae96,0xc(%esp)
c0104a19:	c0 
c0104a1a:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104a21:	c0 
c0104a22:	c7 44 24 04 32 02 00 	movl   $0x232,0x4(%esp)
c0104a29:	00 
c0104a2a:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104a31:	e8 07 ba ff ff       	call   c010043d <__panic>
    assert(page_insert(boot_pgdir, p, 0x100 + PGSIZE, PTE_W) == 0);
c0104a36:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104a3b:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c0104a42:	00 
c0104a43:	c7 44 24 08 00 11 00 	movl   $0x1100,0x8(%esp)
c0104a4a:	00 
c0104a4b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104a4e:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104a52:	89 04 24             	mov    %eax,(%esp)
c0104a55:	e8 07 f5 ff ff       	call   c0103f61 <page_insert>
c0104a5a:	85 c0                	test   %eax,%eax
c0104a5c:	74 24                	je     c0104a82 <check_boot_pgdir+0x271>
c0104a5e:	c7 44 24 0c a8 ae 10 	movl   $0xc010aea8,0xc(%esp)
c0104a65:	c0 
c0104a66:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104a6d:	c0 
c0104a6e:	c7 44 24 04 33 02 00 	movl   $0x233,0x4(%esp)
c0104a75:	00 
c0104a76:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104a7d:	e8 bb b9 ff ff       	call   c010043d <__panic>
    assert(page_ref(p) == 2);
c0104a82:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104a85:	89 04 24             	mov    %eax,(%esp)
c0104a88:	e8 a4 e9 ff ff       	call   c0103431 <page_ref>
c0104a8d:	83 f8 02             	cmp    $0x2,%eax
c0104a90:	74 24                	je     c0104ab6 <check_boot_pgdir+0x2a5>
c0104a92:	c7 44 24 0c df ae 10 	movl   $0xc010aedf,0xc(%esp)
c0104a99:	c0 
c0104a9a:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104aa1:	c0 
c0104aa2:	c7 44 24 04 34 02 00 	movl   $0x234,0x4(%esp)
c0104aa9:	00 
c0104aaa:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104ab1:	e8 87 b9 ff ff       	call   c010043d <__panic>

    const char *str = "ucore: Hello world!!";
c0104ab6:	c7 45 e8 f0 ae 10 c0 	movl   $0xc010aef0,-0x18(%ebp)
    strcpy((void *)0x100, str);
c0104abd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104ac0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104ac4:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0104acb:	e8 84 49 00 00       	call   c0109454 <strcpy>
    assert(strcmp((void *)0x100, (void *)(0x100 + PGSIZE)) == 0);
c0104ad0:	c7 44 24 04 00 11 00 	movl   $0x1100,0x4(%esp)
c0104ad7:	00 
c0104ad8:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0104adf:	e8 ee 49 00 00       	call   c01094d2 <strcmp>
c0104ae4:	85 c0                	test   %eax,%eax
c0104ae6:	74 24                	je     c0104b0c <check_boot_pgdir+0x2fb>
c0104ae8:	c7 44 24 0c 08 af 10 	movl   $0xc010af08,0xc(%esp)
c0104aef:	c0 
c0104af0:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104af7:	c0 
c0104af8:	c7 44 24 04 38 02 00 	movl   $0x238,0x4(%esp)
c0104aff:	00 
c0104b00:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104b07:	e8 31 b9 ff ff       	call   c010043d <__panic>

    *(char *)(page2kva(p) + 0x100) = '\0';
c0104b0c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104b0f:	89 04 24             	mov    %eax,(%esp)
c0104b12:	e8 70 e8 ff ff       	call   c0103387 <page2kva>
c0104b17:	05 00 01 00 00       	add    $0x100,%eax
c0104b1c:	c6 00 00             	movb   $0x0,(%eax)
    assert(strlen((const char *)0x100) == 0);
c0104b1f:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0104b26:	e8 cb 48 00 00       	call   c01093f6 <strlen>
c0104b2b:	85 c0                	test   %eax,%eax
c0104b2d:	74 24                	je     c0104b53 <check_boot_pgdir+0x342>
c0104b2f:	c7 44 24 0c 40 af 10 	movl   $0xc010af40,0xc(%esp)
c0104b36:	c0 
c0104b37:	c7 44 24 08 cd aa 10 	movl   $0xc010aacd,0x8(%esp)
c0104b3e:	c0 
c0104b3f:	c7 44 24 04 3b 02 00 	movl   $0x23b,0x4(%esp)
c0104b46:	00 
c0104b47:	c7 04 24 a8 aa 10 c0 	movl   $0xc010aaa8,(%esp)
c0104b4e:	e8 ea b8 ff ff       	call   c010043d <__panic>

    free_page(p);
c0104b53:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104b5a:	00 
c0104b5b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104b5e:	89 04 24             	mov    %eax,(%esp)
c0104b61:	e8 50 eb ff ff       	call   c01036b6 <free_pages>
    free_page(pde2page(boot_pgdir[0]));
c0104b66:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104b6b:	8b 00                	mov    (%eax),%eax
c0104b6d:	89 04 24             	mov    %eax,(%esp)
c0104b70:	e8 a4 e8 ff ff       	call   c0103419 <pde2page>
c0104b75:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104b7c:	00 
c0104b7d:	89 04 24             	mov    %eax,(%esp)
c0104b80:	e8 31 eb ff ff       	call   c01036b6 <free_pages>
    boot_pgdir[0] = 0;
c0104b85:	a1 e0 89 12 c0       	mov    0xc01289e0,%eax
c0104b8a:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_boot_pgdir() succeeded!\n");
c0104b90:	c7 04 24 64 af 10 c0 	movl   $0xc010af64,(%esp)
c0104b97:	e8 35 b7 ff ff       	call   c01002d1 <cprintf>
}
c0104b9c:	90                   	nop
c0104b9d:	c9                   	leave  
c0104b9e:	c3                   	ret    

c0104b9f <perm2str>:

//perm2str - use string 'u,r,w,-' to present the permission
static const char *
perm2str(int perm) {
c0104b9f:	f3 0f 1e fb          	endbr32 
c0104ba3:	55                   	push   %ebp
c0104ba4:	89 e5                	mov    %esp,%ebp
    static char str[4];
    str[0] = (perm & PTE_U) ? 'u' : '-';
c0104ba6:	8b 45 08             	mov    0x8(%ebp),%eax
c0104ba9:	83 e0 04             	and    $0x4,%eax
c0104bac:	85 c0                	test   %eax,%eax
c0104bae:	74 04                	je     c0104bb4 <perm2str+0x15>
c0104bb0:	b0 75                	mov    $0x75,%al
c0104bb2:	eb 02                	jmp    c0104bb6 <perm2str+0x17>
c0104bb4:	b0 2d                	mov    $0x2d,%al
c0104bb6:	a2 08 c0 12 c0       	mov    %al,0xc012c008
    str[1] = 'r';
c0104bbb:	c6 05 09 c0 12 c0 72 	movb   $0x72,0xc012c009
    str[2] = (perm & PTE_W) ? 'w' : '-';
c0104bc2:	8b 45 08             	mov    0x8(%ebp),%eax
c0104bc5:	83 e0 02             	and    $0x2,%eax
c0104bc8:	85 c0                	test   %eax,%eax
c0104bca:	74 04                	je     c0104bd0 <perm2str+0x31>
c0104bcc:	b0 77                	mov    $0x77,%al
c0104bce:	eb 02                	jmp    c0104bd2 <perm2str+0x33>
c0104bd0:	b0 2d                	mov    $0x2d,%al
c0104bd2:	a2 0a c0 12 c0       	mov    %al,0xc012c00a
    str[3] = '\0';
c0104bd7:	c6 05 0b c0 12 c0 00 	movb   $0x0,0xc012c00b
    return str;
c0104bde:	b8 08 c0 12 c0       	mov    $0xc012c008,%eax
}
c0104be3:	5d                   	pop    %ebp
c0104be4:	c3                   	ret    

c0104be5 <get_pgtable_items>:
//  table:       the beginning addr of table
//  left_store:  the pointer of the high side of table's next range
//  right_store: the pointer of the low side of table's next range
// return value: 0 - not a invalid item range, perm - a valid item range with perm permission 
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
c0104be5:	f3 0f 1e fb          	endbr32 
c0104be9:	55                   	push   %ebp
c0104bea:	89 e5                	mov    %esp,%ebp
c0104bec:	83 ec 10             	sub    $0x10,%esp
    if (start >= right) {
c0104bef:	8b 45 10             	mov    0x10(%ebp),%eax
c0104bf2:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0104bf5:	72 0d                	jb     c0104c04 <get_pgtable_items+0x1f>
        return 0;
c0104bf7:	b8 00 00 00 00       	mov    $0x0,%eax
c0104bfc:	e9 98 00 00 00       	jmp    c0104c99 <get_pgtable_items+0xb4>
    }
    while (start < right && !(table[start] & PTE_P)) {
        start ++;
c0104c01:	ff 45 10             	incl   0x10(%ebp)
    while (start < right && !(table[start] & PTE_P)) {
c0104c04:	8b 45 10             	mov    0x10(%ebp),%eax
c0104c07:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0104c0a:	73 18                	jae    c0104c24 <get_pgtable_items+0x3f>
c0104c0c:	8b 45 10             	mov    0x10(%ebp),%eax
c0104c0f:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0104c16:	8b 45 14             	mov    0x14(%ebp),%eax
c0104c19:	01 d0                	add    %edx,%eax
c0104c1b:	8b 00                	mov    (%eax),%eax
c0104c1d:	83 e0 01             	and    $0x1,%eax
c0104c20:	85 c0                	test   %eax,%eax
c0104c22:	74 dd                	je     c0104c01 <get_pgtable_items+0x1c>
    }
    if (start < right) {
c0104c24:	8b 45 10             	mov    0x10(%ebp),%eax
c0104c27:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0104c2a:	73 68                	jae    c0104c94 <get_pgtable_items+0xaf>
        if (left_store != NULL) {
c0104c2c:	83 7d 18 00          	cmpl   $0x0,0x18(%ebp)
c0104c30:	74 08                	je     c0104c3a <get_pgtable_items+0x55>
            *left_store = start;
c0104c32:	8b 45 18             	mov    0x18(%ebp),%eax
c0104c35:	8b 55 10             	mov    0x10(%ebp),%edx
c0104c38:	89 10                	mov    %edx,(%eax)
        }
        int perm = (table[start ++] & PTE_USER);
c0104c3a:	8b 45 10             	mov    0x10(%ebp),%eax
c0104c3d:	8d 50 01             	lea    0x1(%eax),%edx
c0104c40:	89 55 10             	mov    %edx,0x10(%ebp)
c0104c43:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0104c4a:	8b 45 14             	mov    0x14(%ebp),%eax
c0104c4d:	01 d0                	add    %edx,%eax
c0104c4f:	8b 00                	mov    (%eax),%eax
c0104c51:	83 e0 07             	and    $0x7,%eax
c0104c54:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c0104c57:	eb 03                	jmp    c0104c5c <get_pgtable_items+0x77>
            start ++;
c0104c59:	ff 45 10             	incl   0x10(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c0104c5c:	8b 45 10             	mov    0x10(%ebp),%eax
c0104c5f:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0104c62:	73 1d                	jae    c0104c81 <get_pgtable_items+0x9c>
c0104c64:	8b 45 10             	mov    0x10(%ebp),%eax
c0104c67:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0104c6e:	8b 45 14             	mov    0x14(%ebp),%eax
c0104c71:	01 d0                	add    %edx,%eax
c0104c73:	8b 00                	mov    (%eax),%eax
c0104c75:	83 e0 07             	and    $0x7,%eax
c0104c78:	89 c2                	mov    %eax,%edx
c0104c7a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0104c7d:	39 c2                	cmp    %eax,%edx
c0104c7f:	74 d8                	je     c0104c59 <get_pgtable_items+0x74>
        }
        if (right_store != NULL) {
c0104c81:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c0104c85:	74 08                	je     c0104c8f <get_pgtable_items+0xaa>
            *right_store = start;
c0104c87:	8b 45 1c             	mov    0x1c(%ebp),%eax
c0104c8a:	8b 55 10             	mov    0x10(%ebp),%edx
c0104c8d:	89 10                	mov    %edx,(%eax)
        }
        return perm;
c0104c8f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0104c92:	eb 05                	jmp    c0104c99 <get_pgtable_items+0xb4>
    }
    return 0;
c0104c94:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104c99:	c9                   	leave  
c0104c9a:	c3                   	ret    

c0104c9b <print_pgdir>:

//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
c0104c9b:	f3 0f 1e fb          	endbr32 
c0104c9f:	55                   	push   %ebp
c0104ca0:	89 e5                	mov    %esp,%ebp
c0104ca2:	57                   	push   %edi
c0104ca3:	56                   	push   %esi
c0104ca4:	53                   	push   %ebx
c0104ca5:	83 ec 4c             	sub    $0x4c,%esp
    cprintf("-------------------- BEGIN --------------------\n");
c0104ca8:	c7 04 24 84 af 10 c0 	movl   $0xc010af84,(%esp)
c0104caf:	e8 1d b6 ff ff       	call   c01002d1 <cprintf>
    size_t left, right = 0, perm;
c0104cb4:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c0104cbb:	e9 fa 00 00 00       	jmp    c0104dba <print_pgdir+0x11f>
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0104cc0:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104cc3:	89 04 24             	mov    %eax,(%esp)
c0104cc6:	e8 d4 fe ff ff       	call   c0104b9f <perm2str>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
c0104ccb:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0104cce:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0104cd1:	29 d1                	sub    %edx,%ecx
c0104cd3:	89 ca                	mov    %ecx,%edx
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0104cd5:	89 d6                	mov    %edx,%esi
c0104cd7:	c1 e6 16             	shl    $0x16,%esi
c0104cda:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104cdd:	89 d3                	mov    %edx,%ebx
c0104cdf:	c1 e3 16             	shl    $0x16,%ebx
c0104ce2:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0104ce5:	89 d1                	mov    %edx,%ecx
c0104ce7:	c1 e1 16             	shl    $0x16,%ecx
c0104cea:	8b 7d dc             	mov    -0x24(%ebp),%edi
c0104ced:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0104cf0:	29 d7                	sub    %edx,%edi
c0104cf2:	89 fa                	mov    %edi,%edx
c0104cf4:	89 44 24 14          	mov    %eax,0x14(%esp)
c0104cf8:	89 74 24 10          	mov    %esi,0x10(%esp)
c0104cfc:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c0104d00:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0104d04:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104d08:	c7 04 24 b5 af 10 c0 	movl   $0xc010afb5,(%esp)
c0104d0f:	e8 bd b5 ff ff       	call   c01002d1 <cprintf>
        size_t l, r = left * NPTEENTRY;
c0104d14:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104d17:	c1 e0 0a             	shl    $0xa,%eax
c0104d1a:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c0104d1d:	eb 54                	jmp    c0104d73 <print_pgdir+0xd8>
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c0104d1f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104d22:	89 04 24             	mov    %eax,(%esp)
c0104d25:	e8 75 fe ff ff       	call   c0104b9f <perm2str>
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
c0104d2a:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c0104d2d:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0104d30:	29 d1                	sub    %edx,%ecx
c0104d32:	89 ca                	mov    %ecx,%edx
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c0104d34:	89 d6                	mov    %edx,%esi
c0104d36:	c1 e6 0c             	shl    $0xc,%esi
c0104d39:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0104d3c:	89 d3                	mov    %edx,%ebx
c0104d3e:	c1 e3 0c             	shl    $0xc,%ebx
c0104d41:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0104d44:	89 d1                	mov    %edx,%ecx
c0104d46:	c1 e1 0c             	shl    $0xc,%ecx
c0104d49:	8b 7d d4             	mov    -0x2c(%ebp),%edi
c0104d4c:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0104d4f:	29 d7                	sub    %edx,%edi
c0104d51:	89 fa                	mov    %edi,%edx
c0104d53:	89 44 24 14          	mov    %eax,0x14(%esp)
c0104d57:	89 74 24 10          	mov    %esi,0x10(%esp)
c0104d5b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c0104d5f:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0104d63:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104d67:	c7 04 24 d4 af 10 c0 	movl   $0xc010afd4,(%esp)
c0104d6e:	e8 5e b5 ff ff       	call   c01002d1 <cprintf>
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c0104d73:	be 00 00 c0 fa       	mov    $0xfac00000,%esi
c0104d78:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0104d7b:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104d7e:	89 d3                	mov    %edx,%ebx
c0104d80:	c1 e3 0a             	shl    $0xa,%ebx
c0104d83:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0104d86:	89 d1                	mov    %edx,%ecx
c0104d88:	c1 e1 0a             	shl    $0xa,%ecx
c0104d8b:	8d 55 d4             	lea    -0x2c(%ebp),%edx
c0104d8e:	89 54 24 14          	mov    %edx,0x14(%esp)
c0104d92:	8d 55 d8             	lea    -0x28(%ebp),%edx
c0104d95:	89 54 24 10          	mov    %edx,0x10(%esp)
c0104d99:	89 74 24 0c          	mov    %esi,0xc(%esp)
c0104d9d:	89 44 24 08          	mov    %eax,0x8(%esp)
c0104da1:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0104da5:	89 0c 24             	mov    %ecx,(%esp)
c0104da8:	e8 38 fe ff ff       	call   c0104be5 <get_pgtable_items>
c0104dad:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0104db0:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0104db4:	0f 85 65 ff ff ff    	jne    c0104d1f <print_pgdir+0x84>
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c0104dba:	b9 00 b0 fe fa       	mov    $0xfafeb000,%ecx
c0104dbf:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0104dc2:	8d 55 dc             	lea    -0x24(%ebp),%edx
c0104dc5:	89 54 24 14          	mov    %edx,0x14(%esp)
c0104dc9:	8d 55 e0             	lea    -0x20(%ebp),%edx
c0104dcc:	89 54 24 10          	mov    %edx,0x10(%esp)
c0104dd0:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0104dd4:	89 44 24 08          	mov    %eax,0x8(%esp)
c0104dd8:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
c0104ddf:	00 
c0104de0:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0104de7:	e8 f9 fd ff ff       	call   c0104be5 <get_pgtable_items>
c0104dec:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0104def:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0104df3:	0f 85 c7 fe ff ff    	jne    c0104cc0 <print_pgdir+0x25>
        }
    }
    cprintf("--------------------- END ---------------------\n");
c0104df9:	c7 04 24 f8 af 10 c0 	movl   $0xc010aff8,(%esp)
c0104e00:	e8 cc b4 ff ff       	call   c01002d1 <cprintf>
}
c0104e05:	90                   	nop
c0104e06:	83 c4 4c             	add    $0x4c,%esp
c0104e09:	5b                   	pop    %ebx
c0104e0a:	5e                   	pop    %esi
c0104e0b:	5f                   	pop    %edi
c0104e0c:	5d                   	pop    %ebp
c0104e0d:	c3                   	ret    

c0104e0e <_fifo_init_mm>:
 * (2) _fifo_init_mm: init pra_list_head and let  mm->sm_priv point to the addr of pra_list_head.
 *              Now, From the memory control struct mm_struct, we can access FIFO PRA
 */
static int
_fifo_init_mm(struct mm_struct *mm)
{     
c0104e0e:	f3 0f 1e fb          	endbr32 
c0104e12:	55                   	push   %ebp
c0104e13:	89 e5                	mov    %esp,%ebp
c0104e15:	83 ec 10             	sub    $0x10,%esp
c0104e18:	c7 45 fc 64 e0 12 c0 	movl   $0xc012e064,-0x4(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0104e1f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0104e22:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0104e25:	89 50 04             	mov    %edx,0x4(%eax)
c0104e28:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0104e2b:	8b 50 04             	mov    0x4(%eax),%edx
c0104e2e:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0104e31:	89 10                	mov    %edx,(%eax)
}
c0104e33:	90                   	nop
     list_init(&pra_list_head);
     mm->sm_priv = &pra_list_head;
c0104e34:	8b 45 08             	mov    0x8(%ebp),%eax
c0104e37:	c7 40 14 64 e0 12 c0 	movl   $0xc012e064,0x14(%eax)
     //cprintf(" mm->sm_priv %x in fifo_init_mm\n",mm->sm_priv);
     return 0;
c0104e3e:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104e43:	c9                   	leave  
c0104e44:	c3                   	ret    

c0104e45 <_fifo_map_swappable>:
/*
 * (3)_fifo_map_swappable: According FIFO PRA, we should link the most recent arrival page at the back of pra_list_head qeueue
 */
static int
_fifo_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c0104e45:	f3 0f 1e fb          	endbr32 
c0104e49:	55                   	push   %ebp
c0104e4a:	89 e5                	mov    %esp,%ebp
c0104e4c:	83 ec 38             	sub    $0x38,%esp
    list_entry_t *head=(list_entry_t*) mm->sm_priv;
c0104e4f:	8b 45 08             	mov    0x8(%ebp),%eax
c0104e52:	8b 40 14             	mov    0x14(%eax),%eax
c0104e55:	89 45 f4             	mov    %eax,-0xc(%ebp)
    list_entry_t *entry=&(page->pra_page_link);
c0104e58:	8b 45 10             	mov    0x10(%ebp),%eax
c0104e5b:	83 c0 14             	add    $0x14,%eax
c0104e5e:	89 45 f0             	mov    %eax,-0x10(%ebp)
 
    assert(entry != NULL && head != NULL);
c0104e61:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104e65:	74 06                	je     c0104e6d <_fifo_map_swappable+0x28>
c0104e67:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104e6b:	75 24                	jne    c0104e91 <_fifo_map_swappable+0x4c>
c0104e6d:	c7 44 24 0c 2c b0 10 	movl   $0xc010b02c,0xc(%esp)
c0104e74:	c0 
c0104e75:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0104e7c:	c0 
c0104e7d:	c7 44 24 04 32 00 00 	movl   $0x32,0x4(%esp)
c0104e84:	00 
c0104e85:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0104e8c:	e8 ac b5 ff ff       	call   c010043d <__panic>
c0104e91:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104e94:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0104e97:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e9a:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * Insert the new element @elm *before* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_before(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm->prev, listelm);
c0104e9d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104ea0:	8b 00                	mov    (%eax),%eax
c0104ea2:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0104ea5:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0104ea8:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0104eab:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104eae:	89 45 dc             	mov    %eax,-0x24(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0104eb1:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0104eb4:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0104eb7:	89 10                	mov    %edx,(%eax)
c0104eb9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0104ebc:	8b 10                	mov    (%eax),%edx
c0104ebe:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104ec1:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0104ec4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104ec7:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104eca:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0104ecd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104ed0:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0104ed3:	89 10                	mov    %edx,(%eax)
}
c0104ed5:	90                   	nop
}
c0104ed6:	90                   	nop
    //record the page access situlation
    /*LAB3 EXERCISE 2: YOUR CODE*/ 
    //(1)link the most recent arrival page at the back of the pra_list_head qeueue.
    list_add_before(head,entry);
    return 0;
c0104ed7:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104edc:	c9                   	leave  
c0104edd:	c3                   	ret    

c0104ede <_fifo_swap_out_victim>:
 *  (4)_fifo_swap_out_victim: According FIFO PRA, we should unlink the  earliest arrival page in front of pra_list_head qeueue,
 *                            then assign the value of *ptr_page to the addr of this page.
 */
static int
_fifo_swap_out_victim(struct mm_struct *mm, struct Page ** ptr_page, int in_tick)
{
c0104ede:	f3 0f 1e fb          	endbr32 
c0104ee2:	55                   	push   %ebp
c0104ee3:	89 e5                	mov    %esp,%ebp
c0104ee5:	83 ec 38             	sub    $0x38,%esp
     list_entry_t *head=(list_entry_t*) mm->sm_priv;
c0104ee8:	8b 45 08             	mov    0x8(%ebp),%eax
c0104eeb:	8b 40 14             	mov    0x14(%eax),%eax
c0104eee:	89 45 f4             	mov    %eax,-0xc(%ebp)
         assert(head != NULL);
c0104ef1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104ef5:	75 24                	jne    c0104f1b <_fifo_swap_out_victim+0x3d>
c0104ef7:	c7 44 24 0c 73 b0 10 	movl   $0xc010b073,0xc(%esp)
c0104efe:	c0 
c0104eff:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0104f06:	c0 
c0104f07:	c7 44 24 04 41 00 00 	movl   $0x41,0x4(%esp)
c0104f0e:	00 
c0104f0f:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0104f16:	e8 22 b5 ff ff       	call   c010043d <__panic>
     assert(in_tick==0);
c0104f1b:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0104f1f:	74 24                	je     c0104f45 <_fifo_swap_out_victim+0x67>
c0104f21:	c7 44 24 0c 80 b0 10 	movl   $0xc010b080,0xc(%esp)
c0104f28:	c0 
c0104f29:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0104f30:	c0 
c0104f31:	c7 44 24 04 42 00 00 	movl   $0x42,0x4(%esp)
c0104f38:	00 
c0104f39:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0104f40:	e8 f8 b4 ff ff       	call   c010043d <__panic>
     /* Select the victim */
     /*LAB3 EXERCISE 2: YOUR CODE*/ 
     //(1)  unlink the  earliest arrival page in front of pra_list_head qeueue
     //(2)  assign the value of *ptr_page to the addr of this page
     list_entry_t *le=head->next;
c0104f45:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104f48:	8b 40 04             	mov    0x4(%eax),%eax
c0104f4b:	89 45 f0             	mov    %eax,-0x10(%ebp)
     *ptr_page=le2page(le,pra_page_link);
c0104f4e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104f51:	8d 50 ec             	lea    -0x14(%eax),%edx
c0104f54:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104f57:	89 10                	mov    %edx,(%eax)
c0104f59:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104f5c:	89 45 ec             	mov    %eax,-0x14(%ebp)
    __list_del(listelm->prev, listelm->next);
c0104f5f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104f62:	8b 40 04             	mov    0x4(%eax),%eax
c0104f65:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104f68:	8b 12                	mov    (%edx),%edx
c0104f6a:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0104f6d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0104f70:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104f73:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0104f76:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0104f79:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104f7c:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0104f7f:	89 10                	mov    %edx,(%eax)
}
c0104f81:	90                   	nop
}
c0104f82:	90                   	nop
     list_del(le);
     return 0;
c0104f83:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104f88:	c9                   	leave  
c0104f89:	c3                   	ret    

c0104f8a <_fifo_check_swap>:

static int
_fifo_check_swap(void) {
c0104f8a:	f3 0f 1e fb          	endbr32 
c0104f8e:	55                   	push   %ebp
c0104f8f:	89 e5                	mov    %esp,%ebp
c0104f91:	83 ec 18             	sub    $0x18,%esp
    cprintf("write Virt Page c in fifo_check_swap\n");
c0104f94:	c7 04 24 8c b0 10 c0 	movl   $0xc010b08c,(%esp)
c0104f9b:	e8 31 b3 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c0104fa0:	b8 00 30 00 00       	mov    $0x3000,%eax
c0104fa5:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==4);
c0104fa8:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0104fad:	83 f8 04             	cmp    $0x4,%eax
c0104fb0:	74 24                	je     c0104fd6 <_fifo_check_swap+0x4c>
c0104fb2:	c7 44 24 0c b2 b0 10 	movl   $0xc010b0b2,0xc(%esp)
c0104fb9:	c0 
c0104fba:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0104fc1:	c0 
c0104fc2:	c7 44 24 04 51 00 00 	movl   $0x51,0x4(%esp)
c0104fc9:	00 
c0104fca:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0104fd1:	e8 67 b4 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c0104fd6:	c7 04 24 c4 b0 10 c0 	movl   $0xc010b0c4,(%esp)
c0104fdd:	e8 ef b2 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c0104fe2:	b8 00 10 00 00       	mov    $0x1000,%eax
c0104fe7:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==4);
c0104fea:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0104fef:	83 f8 04             	cmp    $0x4,%eax
c0104ff2:	74 24                	je     c0105018 <_fifo_check_swap+0x8e>
c0104ff4:	c7 44 24 0c b2 b0 10 	movl   $0xc010b0b2,0xc(%esp)
c0104ffb:	c0 
c0104ffc:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0105003:	c0 
c0105004:	c7 44 24 04 54 00 00 	movl   $0x54,0x4(%esp)
c010500b:	00 
c010500c:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0105013:	e8 25 b4 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c0105018:	c7 04 24 ec b0 10 c0 	movl   $0xc010b0ec,(%esp)
c010501f:	e8 ad b2 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c0105024:	b8 00 40 00 00       	mov    $0x4000,%eax
c0105029:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==4);
c010502c:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0105031:	83 f8 04             	cmp    $0x4,%eax
c0105034:	74 24                	je     c010505a <_fifo_check_swap+0xd0>
c0105036:	c7 44 24 0c b2 b0 10 	movl   $0xc010b0b2,0xc(%esp)
c010503d:	c0 
c010503e:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0105045:	c0 
c0105046:	c7 44 24 04 57 00 00 	movl   $0x57,0x4(%esp)
c010504d:	00 
c010504e:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0105055:	e8 e3 b3 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c010505a:	c7 04 24 14 b1 10 c0 	movl   $0xc010b114,(%esp)
c0105061:	e8 6b b2 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c0105066:	b8 00 20 00 00       	mov    $0x2000,%eax
c010506b:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==4);
c010506e:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0105073:	83 f8 04             	cmp    $0x4,%eax
c0105076:	74 24                	je     c010509c <_fifo_check_swap+0x112>
c0105078:	c7 44 24 0c b2 b0 10 	movl   $0xc010b0b2,0xc(%esp)
c010507f:	c0 
c0105080:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0105087:	c0 
c0105088:	c7 44 24 04 5a 00 00 	movl   $0x5a,0x4(%esp)
c010508f:	00 
c0105090:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0105097:	e8 a1 b3 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page e in fifo_check_swap\n");
c010509c:	c7 04 24 3c b1 10 c0 	movl   $0xc010b13c,(%esp)
c01050a3:	e8 29 b2 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x5000 = 0x0e;
c01050a8:	b8 00 50 00 00       	mov    $0x5000,%eax
c01050ad:	c6 00 0e             	movb   $0xe,(%eax)
    assert(pgfault_num==5);
c01050b0:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c01050b5:	83 f8 05             	cmp    $0x5,%eax
c01050b8:	74 24                	je     c01050de <_fifo_check_swap+0x154>
c01050ba:	c7 44 24 0c 62 b1 10 	movl   $0xc010b162,0xc(%esp)
c01050c1:	c0 
c01050c2:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c01050c9:	c0 
c01050ca:	c7 44 24 04 5d 00 00 	movl   $0x5d,0x4(%esp)
c01050d1:	00 
c01050d2:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c01050d9:	e8 5f b3 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c01050de:	c7 04 24 14 b1 10 c0 	movl   $0xc010b114,(%esp)
c01050e5:	e8 e7 b1 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c01050ea:	b8 00 20 00 00       	mov    $0x2000,%eax
c01050ef:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==5);
c01050f2:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c01050f7:	83 f8 05             	cmp    $0x5,%eax
c01050fa:	74 24                	je     c0105120 <_fifo_check_swap+0x196>
c01050fc:	c7 44 24 0c 62 b1 10 	movl   $0xc010b162,0xc(%esp)
c0105103:	c0 
c0105104:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c010510b:	c0 
c010510c:	c7 44 24 04 60 00 00 	movl   $0x60,0x4(%esp)
c0105113:	00 
c0105114:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c010511b:	e8 1d b3 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c0105120:	c7 04 24 c4 b0 10 c0 	movl   $0xc010b0c4,(%esp)
c0105127:	e8 a5 b1 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c010512c:	b8 00 10 00 00       	mov    $0x1000,%eax
c0105131:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==6);
c0105134:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0105139:	83 f8 06             	cmp    $0x6,%eax
c010513c:	74 24                	je     c0105162 <_fifo_check_swap+0x1d8>
c010513e:	c7 44 24 0c 71 b1 10 	movl   $0xc010b171,0xc(%esp)
c0105145:	c0 
c0105146:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c010514d:	c0 
c010514e:	c7 44 24 04 63 00 00 	movl   $0x63,0x4(%esp)
c0105155:	00 
c0105156:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c010515d:	e8 db b2 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c0105162:	c7 04 24 14 b1 10 c0 	movl   $0xc010b114,(%esp)
c0105169:	e8 63 b1 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c010516e:	b8 00 20 00 00       	mov    $0x2000,%eax
c0105173:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==7);
c0105176:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c010517b:	83 f8 07             	cmp    $0x7,%eax
c010517e:	74 24                	je     c01051a4 <_fifo_check_swap+0x21a>
c0105180:	c7 44 24 0c 80 b1 10 	movl   $0xc010b180,0xc(%esp)
c0105187:	c0 
c0105188:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c010518f:	c0 
c0105190:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0105197:	00 
c0105198:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c010519f:	e8 99 b2 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page c in fifo_check_swap\n");
c01051a4:	c7 04 24 8c b0 10 c0 	movl   $0xc010b08c,(%esp)
c01051ab:	e8 21 b1 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c01051b0:	b8 00 30 00 00       	mov    $0x3000,%eax
c01051b5:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==8);
c01051b8:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c01051bd:	83 f8 08             	cmp    $0x8,%eax
c01051c0:	74 24                	je     c01051e6 <_fifo_check_swap+0x25c>
c01051c2:	c7 44 24 0c 8f b1 10 	movl   $0xc010b18f,0xc(%esp)
c01051c9:	c0 
c01051ca:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c01051d1:	c0 
c01051d2:	c7 44 24 04 69 00 00 	movl   $0x69,0x4(%esp)
c01051d9:	00 
c01051da:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c01051e1:	e8 57 b2 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c01051e6:	c7 04 24 ec b0 10 c0 	movl   $0xc010b0ec,(%esp)
c01051ed:	e8 df b0 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c01051f2:	b8 00 40 00 00       	mov    $0x4000,%eax
c01051f7:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==9);
c01051fa:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c01051ff:	83 f8 09             	cmp    $0x9,%eax
c0105202:	74 24                	je     c0105228 <_fifo_check_swap+0x29e>
c0105204:	c7 44 24 0c 9e b1 10 	movl   $0xc010b19e,0xc(%esp)
c010520b:	c0 
c010520c:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0105213:	c0 
c0105214:	c7 44 24 04 6c 00 00 	movl   $0x6c,0x4(%esp)
c010521b:	00 
c010521c:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0105223:	e8 15 b2 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page e in fifo_check_swap\n");
c0105228:	c7 04 24 3c b1 10 c0 	movl   $0xc010b13c,(%esp)
c010522f:	e8 9d b0 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x5000 = 0x0e;
c0105234:	b8 00 50 00 00       	mov    $0x5000,%eax
c0105239:	c6 00 0e             	movb   $0xe,(%eax)
    assert(pgfault_num==10);
c010523c:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0105241:	83 f8 0a             	cmp    $0xa,%eax
c0105244:	74 24                	je     c010526a <_fifo_check_swap+0x2e0>
c0105246:	c7 44 24 0c ad b1 10 	movl   $0xc010b1ad,0xc(%esp)
c010524d:	c0 
c010524e:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0105255:	c0 
c0105256:	c7 44 24 04 6f 00 00 	movl   $0x6f,0x4(%esp)
c010525d:	00 
c010525e:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c0105265:	e8 d3 b1 ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c010526a:	c7 04 24 c4 b0 10 c0 	movl   $0xc010b0c4,(%esp)
c0105271:	e8 5b b0 ff ff       	call   c01002d1 <cprintf>
    assert(*(unsigned char *)0x1000 == 0x0a);
c0105276:	b8 00 10 00 00       	mov    $0x1000,%eax
c010527b:	0f b6 00             	movzbl (%eax),%eax
c010527e:	3c 0a                	cmp    $0xa,%al
c0105280:	74 24                	je     c01052a6 <_fifo_check_swap+0x31c>
c0105282:	c7 44 24 0c c0 b1 10 	movl   $0xc010b1c0,0xc(%esp)
c0105289:	c0 
c010528a:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c0105291:	c0 
c0105292:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c0105299:	00 
c010529a:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c01052a1:	e8 97 b1 ff ff       	call   c010043d <__panic>
    *(unsigned char *)0x1000 = 0x0a;
c01052a6:	b8 00 10 00 00       	mov    $0x1000,%eax
c01052ab:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==11);
c01052ae:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c01052b3:	83 f8 0b             	cmp    $0xb,%eax
c01052b6:	74 24                	je     c01052dc <_fifo_check_swap+0x352>
c01052b8:	c7 44 24 0c e1 b1 10 	movl   $0xc010b1e1,0xc(%esp)
c01052bf:	c0 
c01052c0:	c7 44 24 08 4a b0 10 	movl   $0xc010b04a,0x8(%esp)
c01052c7:	c0 
c01052c8:	c7 44 24 04 73 00 00 	movl   $0x73,0x4(%esp)
c01052cf:	00 
c01052d0:	c7 04 24 5f b0 10 c0 	movl   $0xc010b05f,(%esp)
c01052d7:	e8 61 b1 ff ff       	call   c010043d <__panic>
    return 0;
c01052dc:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01052e1:	c9                   	leave  
c01052e2:	c3                   	ret    

c01052e3 <_fifo_init>:


static int
_fifo_init(void)
{
c01052e3:	f3 0f 1e fb          	endbr32 
c01052e7:	55                   	push   %ebp
c01052e8:	89 e5                	mov    %esp,%ebp
    return 0;
c01052ea:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01052ef:	5d                   	pop    %ebp
c01052f0:	c3                   	ret    

c01052f1 <_fifo_set_unswappable>:

static int
_fifo_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c01052f1:	f3 0f 1e fb          	endbr32 
c01052f5:	55                   	push   %ebp
c01052f6:	89 e5                	mov    %esp,%ebp
    return 0;
c01052f8:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01052fd:	5d                   	pop    %ebp
c01052fe:	c3                   	ret    

c01052ff <_fifo_tick_event>:

static int
_fifo_tick_event(struct mm_struct *mm)
{ return 0; }
c01052ff:	f3 0f 1e fb          	endbr32 
c0105303:	55                   	push   %ebp
c0105304:	89 e5                	mov    %esp,%ebp
c0105306:	b8 00 00 00 00       	mov    $0x0,%eax
c010530b:	5d                   	pop    %ebp
c010530c:	c3                   	ret    

c010530d <pa2page>:
pa2page(uintptr_t pa) {
c010530d:	55                   	push   %ebp
c010530e:	89 e5                	mov    %esp,%ebp
c0105310:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0105313:	8b 45 08             	mov    0x8(%ebp),%eax
c0105316:	c1 e8 0c             	shr    $0xc,%eax
c0105319:	89 c2                	mov    %eax,%edx
c010531b:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0105320:	39 c2                	cmp    %eax,%edx
c0105322:	72 1c                	jb     c0105340 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0105324:	c7 44 24 08 04 b2 10 	movl   $0xc010b204,0x8(%esp)
c010532b:	c0 
c010532c:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0105333:	00 
c0105334:	c7 04 24 23 b2 10 c0 	movl   $0xc010b223,(%esp)
c010533b:	e8 fd b0 ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0105340:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c0105345:	8b 55 08             	mov    0x8(%ebp),%edx
c0105348:	c1 ea 0c             	shr    $0xc,%edx
c010534b:	c1 e2 05             	shl    $0x5,%edx
c010534e:	01 d0                	add    %edx,%eax
}
c0105350:	c9                   	leave  
c0105351:	c3                   	ret    

c0105352 <pde2page>:
pde2page(pde_t pde) {
c0105352:	55                   	push   %ebp
c0105353:	89 e5                	mov    %esp,%ebp
c0105355:	83 ec 18             	sub    $0x18,%esp
    return pa2page(PDE_ADDR(pde));
c0105358:	8b 45 08             	mov    0x8(%ebp),%eax
c010535b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105360:	89 04 24             	mov    %eax,(%esp)
c0105363:	e8 a5 ff ff ff       	call   c010530d <pa2page>
}
c0105368:	c9                   	leave  
c0105369:	c3                   	ret    

c010536a <mm_create>:
static void check_vma_struct(void);
static void check_pgfault(void);

// mm_create -  alloc a mm_struct & initialize it.
struct mm_struct *
mm_create(void) {
c010536a:	f3 0f 1e fb          	endbr32 
c010536e:	55                   	push   %ebp
c010536f:	89 e5                	mov    %esp,%ebp
c0105371:	83 ec 28             	sub    $0x28,%esp
    struct mm_struct *mm = kmalloc(sizeof(struct mm_struct));
c0105374:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c010537b:	e8 dd 12 00 00       	call   c010665d <kmalloc>
c0105380:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (mm != NULL) {
c0105383:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105387:	74 59                	je     c01053e2 <mm_create+0x78>
        list_init(&(mm->mmap_list));
c0105389:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010538c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    elm->prev = elm->next = elm;
c010538f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105392:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0105395:	89 50 04             	mov    %edx,0x4(%eax)
c0105398:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010539b:	8b 50 04             	mov    0x4(%eax),%edx
c010539e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01053a1:	89 10                	mov    %edx,(%eax)
}
c01053a3:	90                   	nop
        mm->mmap_cache = NULL;
c01053a4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01053a7:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        mm->pgdir = NULL;
c01053ae:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01053b1:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        mm->map_count = 0;
c01053b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01053bb:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)

        if (swap_init_ok) swap_init_mm(mm);
c01053c2:	a1 14 c0 12 c0       	mov    0xc012c014,%eax
c01053c7:	85 c0                	test   %eax,%eax
c01053c9:	74 0d                	je     c01053d8 <mm_create+0x6e>
c01053cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01053ce:	89 04 24             	mov    %eax,(%esp)
c01053d1:	e8 02 15 00 00       	call   c01068d8 <swap_init_mm>
c01053d6:	eb 0a                	jmp    c01053e2 <mm_create+0x78>
        else mm->sm_priv = NULL;
c01053d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01053db:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
    }
    return mm;
c01053e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01053e5:	c9                   	leave  
c01053e6:	c3                   	ret    

c01053e7 <vma_create>:

// vma_create - alloc a vma_struct & initialize it. (addr range: vm_start~vm_end)
struct vma_struct *
vma_create(uintptr_t vm_start, uintptr_t vm_end, uint32_t vm_flags) {
c01053e7:	f3 0f 1e fb          	endbr32 
c01053eb:	55                   	push   %ebp
c01053ec:	89 e5                	mov    %esp,%ebp
c01053ee:	83 ec 28             	sub    $0x28,%esp
    struct vma_struct *vma = kmalloc(sizeof(struct vma_struct));
c01053f1:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c01053f8:	e8 60 12 00 00       	call   c010665d <kmalloc>
c01053fd:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (vma != NULL) {
c0105400:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105404:	74 1b                	je     c0105421 <vma_create+0x3a>
        vma->vm_start = vm_start;
c0105406:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105409:	8b 55 08             	mov    0x8(%ebp),%edx
c010540c:	89 50 04             	mov    %edx,0x4(%eax)
        vma->vm_end = vm_end;
c010540f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105412:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105415:	89 50 08             	mov    %edx,0x8(%eax)
        vma->vm_flags = vm_flags;
c0105418:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010541b:	8b 55 10             	mov    0x10(%ebp),%edx
c010541e:	89 50 0c             	mov    %edx,0xc(%eax)
    }
    return vma;
c0105421:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0105424:	c9                   	leave  
c0105425:	c3                   	ret    

c0105426 <find_vma>:


// find_vma - find a vma  (vma->vm_start <= addr <= vma_vm_end)
struct vma_struct *
find_vma(struct mm_struct *mm, uintptr_t addr) {
c0105426:	f3 0f 1e fb          	endbr32 
c010542a:	55                   	push   %ebp
c010542b:	89 e5                	mov    %esp,%ebp
c010542d:	83 ec 20             	sub    $0x20,%esp
    struct vma_struct *vma = NULL;
c0105430:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    if (mm != NULL) {
c0105437:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010543b:	0f 84 95 00 00 00    	je     c01054d6 <find_vma+0xb0>
        vma = mm->mmap_cache;
c0105441:	8b 45 08             	mov    0x8(%ebp),%eax
c0105444:	8b 40 08             	mov    0x8(%eax),%eax
c0105447:	89 45 fc             	mov    %eax,-0x4(%ebp)
        if (!(vma != NULL && vma->vm_start <= addr && vma->vm_end > addr)) {
c010544a:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c010544e:	74 16                	je     c0105466 <find_vma+0x40>
c0105450:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105453:	8b 40 04             	mov    0x4(%eax),%eax
c0105456:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0105459:	72 0b                	jb     c0105466 <find_vma+0x40>
c010545b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010545e:	8b 40 08             	mov    0x8(%eax),%eax
c0105461:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0105464:	72 61                	jb     c01054c7 <find_vma+0xa1>
                bool found = 0;
c0105466:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
                list_entry_t *list = &(mm->mmap_list), *le = list;
c010546d:	8b 45 08             	mov    0x8(%ebp),%eax
c0105470:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105473:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105476:	89 45 f4             	mov    %eax,-0xc(%ebp)
                while ((le = list_next(le)) != list) {
c0105479:	eb 28                	jmp    c01054a3 <find_vma+0x7d>
                    vma = le2vma(le, list_link);
c010547b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010547e:	83 e8 10             	sub    $0x10,%eax
c0105481:	89 45 fc             	mov    %eax,-0x4(%ebp)
                    if (vma->vm_start<=addr && addr < vma->vm_end) {
c0105484:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105487:	8b 40 04             	mov    0x4(%eax),%eax
c010548a:	39 45 0c             	cmp    %eax,0xc(%ebp)
c010548d:	72 14                	jb     c01054a3 <find_vma+0x7d>
c010548f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105492:	8b 40 08             	mov    0x8(%eax),%eax
c0105495:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0105498:	73 09                	jae    c01054a3 <find_vma+0x7d>
                        found = 1;
c010549a:	c7 45 f8 01 00 00 00 	movl   $0x1,-0x8(%ebp)
                        break;
c01054a1:	eb 17                	jmp    c01054ba <find_vma+0x94>
c01054a3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01054a6:	89 45 ec             	mov    %eax,-0x14(%ebp)
    return listelm->next;
c01054a9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01054ac:	8b 40 04             	mov    0x4(%eax),%eax
                while ((le = list_next(le)) != list) {
c01054af:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01054b2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01054b5:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c01054b8:	75 c1                	jne    c010547b <find_vma+0x55>
                    }
                }
                if (!found) {
c01054ba:	83 7d f8 00          	cmpl   $0x0,-0x8(%ebp)
c01054be:	75 07                	jne    c01054c7 <find_vma+0xa1>
                    vma = NULL;
c01054c0:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
                }
        }
        if (vma != NULL) {
c01054c7:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c01054cb:	74 09                	je     c01054d6 <find_vma+0xb0>
            mm->mmap_cache = vma;
c01054cd:	8b 45 08             	mov    0x8(%ebp),%eax
c01054d0:	8b 55 fc             	mov    -0x4(%ebp),%edx
c01054d3:	89 50 08             	mov    %edx,0x8(%eax)
        }
    }
    return vma;
c01054d6:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c01054d9:	c9                   	leave  
c01054da:	c3                   	ret    

c01054db <check_vma_overlap>:


// check_vma_overlap - check if vma1 overlaps vma2 ?
static inline void
check_vma_overlap(struct vma_struct *prev, struct vma_struct *next) {
c01054db:	55                   	push   %ebp
c01054dc:	89 e5                	mov    %esp,%ebp
c01054de:	83 ec 18             	sub    $0x18,%esp
    assert(prev->vm_start < prev->vm_end);
c01054e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01054e4:	8b 50 04             	mov    0x4(%eax),%edx
c01054e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01054ea:	8b 40 08             	mov    0x8(%eax),%eax
c01054ed:	39 c2                	cmp    %eax,%edx
c01054ef:	72 24                	jb     c0105515 <check_vma_overlap+0x3a>
c01054f1:	c7 44 24 0c 31 b2 10 	movl   $0xc010b231,0xc(%esp)
c01054f8:	c0 
c01054f9:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105500:	c0 
c0105501:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
c0105508:	00 
c0105509:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105510:	e8 28 af ff ff       	call   c010043d <__panic>
    assert(prev->vm_end <= next->vm_start);
c0105515:	8b 45 08             	mov    0x8(%ebp),%eax
c0105518:	8b 50 08             	mov    0x8(%eax),%edx
c010551b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010551e:	8b 40 04             	mov    0x4(%eax),%eax
c0105521:	39 c2                	cmp    %eax,%edx
c0105523:	76 24                	jbe    c0105549 <check_vma_overlap+0x6e>
c0105525:	c7 44 24 0c 74 b2 10 	movl   $0xc010b274,0xc(%esp)
c010552c:	c0 
c010552d:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105534:	c0 
c0105535:	c7 44 24 04 69 00 00 	movl   $0x69,0x4(%esp)
c010553c:	00 
c010553d:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105544:	e8 f4 ae ff ff       	call   c010043d <__panic>
    assert(next->vm_start < next->vm_end);
c0105549:	8b 45 0c             	mov    0xc(%ebp),%eax
c010554c:	8b 50 04             	mov    0x4(%eax),%edx
c010554f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105552:	8b 40 08             	mov    0x8(%eax),%eax
c0105555:	39 c2                	cmp    %eax,%edx
c0105557:	72 24                	jb     c010557d <check_vma_overlap+0xa2>
c0105559:	c7 44 24 0c 93 b2 10 	movl   $0xc010b293,0xc(%esp)
c0105560:	c0 
c0105561:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105568:	c0 
c0105569:	c7 44 24 04 6a 00 00 	movl   $0x6a,0x4(%esp)
c0105570:	00 
c0105571:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105578:	e8 c0 ae ff ff       	call   c010043d <__panic>
}
c010557d:	90                   	nop
c010557e:	c9                   	leave  
c010557f:	c3                   	ret    

c0105580 <insert_vma_struct>:


// insert_vma_struct -insert vma in mm's list link
void
insert_vma_struct(struct mm_struct *mm, struct vma_struct *vma) {
c0105580:	f3 0f 1e fb          	endbr32 
c0105584:	55                   	push   %ebp
c0105585:	89 e5                	mov    %esp,%ebp
c0105587:	83 ec 48             	sub    $0x48,%esp
    assert(vma->vm_start < vma->vm_end);
c010558a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010558d:	8b 50 04             	mov    0x4(%eax),%edx
c0105590:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105593:	8b 40 08             	mov    0x8(%eax),%eax
c0105596:	39 c2                	cmp    %eax,%edx
c0105598:	72 24                	jb     c01055be <insert_vma_struct+0x3e>
c010559a:	c7 44 24 0c b1 b2 10 	movl   $0xc010b2b1,0xc(%esp)
c01055a1:	c0 
c01055a2:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c01055a9:	c0 
c01055aa:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c01055b1:	00 
c01055b2:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c01055b9:	e8 7f ae ff ff       	call   c010043d <__panic>
    list_entry_t *list = &(mm->mmap_list);
c01055be:	8b 45 08             	mov    0x8(%ebp),%eax
c01055c1:	89 45 ec             	mov    %eax,-0x14(%ebp)
    list_entry_t *le_prev = list, *le_next;
c01055c4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01055c7:	89 45 f4             	mov    %eax,-0xc(%ebp)

        list_entry_t *le = list;
c01055ca:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01055cd:	89 45 f0             	mov    %eax,-0x10(%ebp)
        while ((le = list_next(le)) != list) {
c01055d0:	eb 1f                	jmp    c01055f1 <insert_vma_struct+0x71>
            struct vma_struct *mmap_prev = le2vma(le, list_link);
c01055d2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01055d5:	83 e8 10             	sub    $0x10,%eax
c01055d8:	89 45 e8             	mov    %eax,-0x18(%ebp)
            if (mmap_prev->vm_start > vma->vm_start) {
c01055db:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01055de:	8b 50 04             	mov    0x4(%eax),%edx
c01055e1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01055e4:	8b 40 04             	mov    0x4(%eax),%eax
c01055e7:	39 c2                	cmp    %eax,%edx
c01055e9:	77 1f                	ja     c010560a <insert_vma_struct+0x8a>
                break;
            }
            le_prev = le;
c01055eb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01055ee:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01055f1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01055f4:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01055f7:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01055fa:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c01055fd:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105600:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105603:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0105606:	75 ca                	jne    c01055d2 <insert_vma_struct+0x52>
c0105608:	eb 01                	jmp    c010560b <insert_vma_struct+0x8b>
                break;
c010560a:	90                   	nop
c010560b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010560e:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0105611:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105614:	8b 40 04             	mov    0x4(%eax),%eax
        }

    le_next = list_next(le_prev);
c0105617:	89 45 e4             	mov    %eax,-0x1c(%ebp)

    /* check overlap */
    if (le_prev != list) {
c010561a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010561d:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0105620:	74 15                	je     c0105637 <insert_vma_struct+0xb7>
        check_vma_overlap(le2vma(le_prev, list_link), vma);
c0105622:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105625:	8d 50 f0             	lea    -0x10(%eax),%edx
c0105628:	8b 45 0c             	mov    0xc(%ebp),%eax
c010562b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010562f:	89 14 24             	mov    %edx,(%esp)
c0105632:	e8 a4 fe ff ff       	call   c01054db <check_vma_overlap>
    }
    if (le_next != list) {
c0105637:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010563a:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010563d:	74 15                	je     c0105654 <insert_vma_struct+0xd4>
        check_vma_overlap(vma, le2vma(le_next, list_link));
c010563f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105642:	83 e8 10             	sub    $0x10,%eax
c0105645:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105649:	8b 45 0c             	mov    0xc(%ebp),%eax
c010564c:	89 04 24             	mov    %eax,(%esp)
c010564f:	e8 87 fe ff ff       	call   c01054db <check_vma_overlap>
    }

    vma->vm_mm = mm;
c0105654:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105657:	8b 55 08             	mov    0x8(%ebp),%edx
c010565a:	89 10                	mov    %edx,(%eax)
    list_add_after(le_prev, &(vma->list_link));
c010565c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010565f:	8d 50 10             	lea    0x10(%eax),%edx
c0105662:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105665:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0105668:	89 55 d4             	mov    %edx,-0x2c(%ebp)
    __list_add(elm, listelm, listelm->next);
c010566b:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010566e:	8b 40 04             	mov    0x4(%eax),%eax
c0105671:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0105674:	89 55 d0             	mov    %edx,-0x30(%ebp)
c0105677:	8b 55 d8             	mov    -0x28(%ebp),%edx
c010567a:	89 55 cc             	mov    %edx,-0x34(%ebp)
c010567d:	89 45 c8             	mov    %eax,-0x38(%ebp)
    prev->next = next->prev = elm;
c0105680:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0105683:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0105686:	89 10                	mov    %edx,(%eax)
c0105688:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010568b:	8b 10                	mov    (%eax),%edx
c010568d:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0105690:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0105693:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0105696:	8b 55 c8             	mov    -0x38(%ebp),%edx
c0105699:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c010569c:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010569f:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01056a2:	89 10                	mov    %edx,(%eax)
}
c01056a4:	90                   	nop
}
c01056a5:	90                   	nop

    mm->map_count ++;
c01056a6:	8b 45 08             	mov    0x8(%ebp),%eax
c01056a9:	8b 40 10             	mov    0x10(%eax),%eax
c01056ac:	8d 50 01             	lea    0x1(%eax),%edx
c01056af:	8b 45 08             	mov    0x8(%ebp),%eax
c01056b2:	89 50 10             	mov    %edx,0x10(%eax)
}
c01056b5:	90                   	nop
c01056b6:	c9                   	leave  
c01056b7:	c3                   	ret    

c01056b8 <mm_destroy>:

// mm_destroy - free mm and mm internal fields
void
mm_destroy(struct mm_struct *mm) {
c01056b8:	f3 0f 1e fb          	endbr32 
c01056bc:	55                   	push   %ebp
c01056bd:	89 e5                	mov    %esp,%ebp
c01056bf:	83 ec 38             	sub    $0x38,%esp

    list_entry_t *list = &(mm->mmap_list), *le;
c01056c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01056c5:	89 45 f4             	mov    %eax,-0xc(%ebp)
    while ((le = list_next(list)) != list) {
c01056c8:	eb 38                	jmp    c0105702 <mm_destroy+0x4a>
c01056ca:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01056cd:	89 45 ec             	mov    %eax,-0x14(%ebp)
    __list_del(listelm->prev, listelm->next);
c01056d0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01056d3:	8b 40 04             	mov    0x4(%eax),%eax
c01056d6:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01056d9:	8b 12                	mov    (%edx),%edx
c01056db:	89 55 e8             	mov    %edx,-0x18(%ebp)
c01056de:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    prev->next = next;
c01056e1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01056e4:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01056e7:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c01056ea:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01056ed:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01056f0:	89 10                	mov    %edx,(%eax)
}
c01056f2:	90                   	nop
}
c01056f3:	90                   	nop
        list_del(le);
        kfree(le2vma(le, list_link));  //kfree vma        
c01056f4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01056f7:	83 e8 10             	sub    $0x10,%eax
c01056fa:	89 04 24             	mov    %eax,(%esp)
c01056fd:	e8 7a 0f 00 00       	call   c010667c <kfree>
c0105702:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105705:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return listelm->next;
c0105708:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010570b:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(list)) != list) {
c010570e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105711:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105714:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0105717:	75 b1                	jne    c01056ca <mm_destroy+0x12>
    }
    kfree(mm); //kfree mm
c0105719:	8b 45 08             	mov    0x8(%ebp),%eax
c010571c:	89 04 24             	mov    %eax,(%esp)
c010571f:	e8 58 0f 00 00       	call   c010667c <kfree>
    mm=NULL;
c0105724:	c7 45 08 00 00 00 00 	movl   $0x0,0x8(%ebp)
}
c010572b:	90                   	nop
c010572c:	c9                   	leave  
c010572d:	c3                   	ret    

c010572e <vmm_init>:

// vmm_init - initialize virtual memory management
//          - now just call check_vmm to check correctness of vmm
void
vmm_init(void) {
c010572e:	f3 0f 1e fb          	endbr32 
c0105732:	55                   	push   %ebp
c0105733:	89 e5                	mov    %esp,%ebp
c0105735:	83 ec 08             	sub    $0x8,%esp
    check_vmm();
c0105738:	e8 03 00 00 00       	call   c0105740 <check_vmm>
}
c010573d:	90                   	nop
c010573e:	c9                   	leave  
c010573f:	c3                   	ret    

c0105740 <check_vmm>:

// check_vmm - check correctness of vmm
static void
check_vmm(void) {
c0105740:	f3 0f 1e fb          	endbr32 
c0105744:	55                   	push   %ebp
c0105745:	89 e5                	mov    %esp,%ebp
c0105747:	83 ec 28             	sub    $0x28,%esp
    size_t nr_free_pages_store = nr_free_pages();
c010574a:	e8 9e df ff ff       	call   c01036ed <nr_free_pages>
c010574f:	89 45 f4             	mov    %eax,-0xc(%ebp)
    
    check_vma_struct();
c0105752:	e8 14 00 00 00       	call   c010576b <check_vma_struct>
    check_pgfault();
c0105757:	e8 a5 04 00 00       	call   c0105c01 <check_pgfault>

    cprintf("check_vmm() succeeded.\n");
c010575c:	c7 04 24 cd b2 10 c0 	movl   $0xc010b2cd,(%esp)
c0105763:	e8 69 ab ff ff       	call   c01002d1 <cprintf>
}
c0105768:	90                   	nop
c0105769:	c9                   	leave  
c010576a:	c3                   	ret    

c010576b <check_vma_struct>:

static void
check_vma_struct(void) {
c010576b:	f3 0f 1e fb          	endbr32 
c010576f:	55                   	push   %ebp
c0105770:	89 e5                	mov    %esp,%ebp
c0105772:	83 ec 68             	sub    $0x68,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0105775:	e8 73 df ff ff       	call   c01036ed <nr_free_pages>
c010577a:	89 45 ec             	mov    %eax,-0x14(%ebp)

    struct mm_struct *mm = mm_create();
c010577d:	e8 e8 fb ff ff       	call   c010536a <mm_create>
c0105782:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(mm != NULL);
c0105785:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0105789:	75 24                	jne    c01057af <check_vma_struct+0x44>
c010578b:	c7 44 24 0c e5 b2 10 	movl   $0xc010b2e5,0xc(%esp)
c0105792:	c0 
c0105793:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c010579a:	c0 
c010579b:	c7 44 24 04 b2 00 00 	movl   $0xb2,0x4(%esp)
c01057a2:	00 
c01057a3:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c01057aa:	e8 8e ac ff ff       	call   c010043d <__panic>

    int step1 = 10, step2 = step1 * 10;
c01057af:	c7 45 e4 0a 00 00 00 	movl   $0xa,-0x1c(%ebp)
c01057b6:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01057b9:	89 d0                	mov    %edx,%eax
c01057bb:	c1 e0 02             	shl    $0x2,%eax
c01057be:	01 d0                	add    %edx,%eax
c01057c0:	01 c0                	add    %eax,%eax
c01057c2:	89 45 e0             	mov    %eax,-0x20(%ebp)

    int i;
    for (i = step1; i >= 1; i --) {
c01057c5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01057c8:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01057cb:	eb 6f                	jmp    c010583c <check_vma_struct+0xd1>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c01057cd:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01057d0:	89 d0                	mov    %edx,%eax
c01057d2:	c1 e0 02             	shl    $0x2,%eax
c01057d5:	01 d0                	add    %edx,%eax
c01057d7:	83 c0 02             	add    $0x2,%eax
c01057da:	89 c1                	mov    %eax,%ecx
c01057dc:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01057df:	89 d0                	mov    %edx,%eax
c01057e1:	c1 e0 02             	shl    $0x2,%eax
c01057e4:	01 d0                	add    %edx,%eax
c01057e6:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01057ed:	00 
c01057ee:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c01057f2:	89 04 24             	mov    %eax,(%esp)
c01057f5:	e8 ed fb ff ff       	call   c01053e7 <vma_create>
c01057fa:	89 45 bc             	mov    %eax,-0x44(%ebp)
        assert(vma != NULL);
c01057fd:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0105801:	75 24                	jne    c0105827 <check_vma_struct+0xbc>
c0105803:	c7 44 24 0c f0 b2 10 	movl   $0xc010b2f0,0xc(%esp)
c010580a:	c0 
c010580b:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105812:	c0 
c0105813:	c7 44 24 04 b9 00 00 	movl   $0xb9,0x4(%esp)
c010581a:	00 
c010581b:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105822:	e8 16 ac ff ff       	call   c010043d <__panic>
        insert_vma_struct(mm, vma);
c0105827:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010582a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010582e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105831:	89 04 24             	mov    %eax,(%esp)
c0105834:	e8 47 fd ff ff       	call   c0105580 <insert_vma_struct>
    for (i = step1; i >= 1; i --) {
c0105839:	ff 4d f4             	decl   -0xc(%ebp)
c010583c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105840:	7f 8b                	jg     c01057cd <check_vma_struct+0x62>
    }

    for (i = step1 + 1; i <= step2; i ++) {
c0105842:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105845:	40                   	inc    %eax
c0105846:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105849:	eb 6f                	jmp    c01058ba <check_vma_struct+0x14f>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c010584b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010584e:	89 d0                	mov    %edx,%eax
c0105850:	c1 e0 02             	shl    $0x2,%eax
c0105853:	01 d0                	add    %edx,%eax
c0105855:	83 c0 02             	add    $0x2,%eax
c0105858:	89 c1                	mov    %eax,%ecx
c010585a:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010585d:	89 d0                	mov    %edx,%eax
c010585f:	c1 e0 02             	shl    $0x2,%eax
c0105862:	01 d0                	add    %edx,%eax
c0105864:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010586b:	00 
c010586c:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0105870:	89 04 24             	mov    %eax,(%esp)
c0105873:	e8 6f fb ff ff       	call   c01053e7 <vma_create>
c0105878:	89 45 c0             	mov    %eax,-0x40(%ebp)
        assert(vma != NULL);
c010587b:	83 7d c0 00          	cmpl   $0x0,-0x40(%ebp)
c010587f:	75 24                	jne    c01058a5 <check_vma_struct+0x13a>
c0105881:	c7 44 24 0c f0 b2 10 	movl   $0xc010b2f0,0xc(%esp)
c0105888:	c0 
c0105889:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105890:	c0 
c0105891:	c7 44 24 04 bf 00 00 	movl   $0xbf,0x4(%esp)
c0105898:	00 
c0105899:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c01058a0:	e8 98 ab ff ff       	call   c010043d <__panic>
        insert_vma_struct(mm, vma);
c01058a5:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01058a8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01058ac:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01058af:	89 04 24             	mov    %eax,(%esp)
c01058b2:	e8 c9 fc ff ff       	call   c0105580 <insert_vma_struct>
    for (i = step1 + 1; i <= step2; i ++) {
c01058b7:	ff 45 f4             	incl   -0xc(%ebp)
c01058ba:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01058bd:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c01058c0:	7e 89                	jle    c010584b <check_vma_struct+0xe0>
    }

    list_entry_t *le = list_next(&(mm->mmap_list));
c01058c2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01058c5:	89 45 b8             	mov    %eax,-0x48(%ebp)
c01058c8:	8b 45 b8             	mov    -0x48(%ebp),%eax
c01058cb:	8b 40 04             	mov    0x4(%eax),%eax
c01058ce:	89 45 f0             	mov    %eax,-0x10(%ebp)

    for (i = 1; i <= step2; i ++) {
c01058d1:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
c01058d8:	e9 96 00 00 00       	jmp    c0105973 <check_vma_struct+0x208>
        assert(le != &(mm->mmap_list));
c01058dd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01058e0:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01058e3:	75 24                	jne    c0105909 <check_vma_struct+0x19e>
c01058e5:	c7 44 24 0c fc b2 10 	movl   $0xc010b2fc,0xc(%esp)
c01058ec:	c0 
c01058ed:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c01058f4:	c0 
c01058f5:	c7 44 24 04 c6 00 00 	movl   $0xc6,0x4(%esp)
c01058fc:	00 
c01058fd:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105904:	e8 34 ab ff ff       	call   c010043d <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
c0105909:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010590c:	83 e8 10             	sub    $0x10,%eax
c010590f:	89 45 c4             	mov    %eax,-0x3c(%ebp)
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
c0105912:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0105915:	8b 48 04             	mov    0x4(%eax),%ecx
c0105918:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010591b:	89 d0                	mov    %edx,%eax
c010591d:	c1 e0 02             	shl    $0x2,%eax
c0105920:	01 d0                	add    %edx,%eax
c0105922:	39 c1                	cmp    %eax,%ecx
c0105924:	75 17                	jne    c010593d <check_vma_struct+0x1d2>
c0105926:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0105929:	8b 48 08             	mov    0x8(%eax),%ecx
c010592c:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010592f:	89 d0                	mov    %edx,%eax
c0105931:	c1 e0 02             	shl    $0x2,%eax
c0105934:	01 d0                	add    %edx,%eax
c0105936:	83 c0 02             	add    $0x2,%eax
c0105939:	39 c1                	cmp    %eax,%ecx
c010593b:	74 24                	je     c0105961 <check_vma_struct+0x1f6>
c010593d:	c7 44 24 0c 14 b3 10 	movl   $0xc010b314,0xc(%esp)
c0105944:	c0 
c0105945:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c010594c:	c0 
c010594d:	c7 44 24 04 c8 00 00 	movl   $0xc8,0x4(%esp)
c0105954:	00 
c0105955:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c010595c:	e8 dc aa ff ff       	call   c010043d <__panic>
c0105961:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105964:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c0105967:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010596a:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c010596d:	89 45 f0             	mov    %eax,-0x10(%ebp)
    for (i = 1; i <= step2; i ++) {
c0105970:	ff 45 f4             	incl   -0xc(%ebp)
c0105973:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105976:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0105979:	0f 8e 5e ff ff ff    	jle    c01058dd <check_vma_struct+0x172>
    }

    for (i = 5; i <= 5 * step2; i +=5) {
c010597f:	c7 45 f4 05 00 00 00 	movl   $0x5,-0xc(%ebp)
c0105986:	e9 cb 01 00 00       	jmp    c0105b56 <check_vma_struct+0x3eb>
        struct vma_struct *vma1 = find_vma(mm, i);
c010598b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010598e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105992:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105995:	89 04 24             	mov    %eax,(%esp)
c0105998:	e8 89 fa ff ff       	call   c0105426 <find_vma>
c010599d:	89 45 d8             	mov    %eax,-0x28(%ebp)
        assert(vma1 != NULL);
c01059a0:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c01059a4:	75 24                	jne    c01059ca <check_vma_struct+0x25f>
c01059a6:	c7 44 24 0c 49 b3 10 	movl   $0xc010b349,0xc(%esp)
c01059ad:	c0 
c01059ae:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c01059b5:	c0 
c01059b6:	c7 44 24 04 ce 00 00 	movl   $0xce,0x4(%esp)
c01059bd:	00 
c01059be:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c01059c5:	e8 73 aa ff ff       	call   c010043d <__panic>
        struct vma_struct *vma2 = find_vma(mm, i+1);
c01059ca:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01059cd:	40                   	inc    %eax
c01059ce:	89 44 24 04          	mov    %eax,0x4(%esp)
c01059d2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01059d5:	89 04 24             	mov    %eax,(%esp)
c01059d8:	e8 49 fa ff ff       	call   c0105426 <find_vma>
c01059dd:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        assert(vma2 != NULL);
c01059e0:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
c01059e4:	75 24                	jne    c0105a0a <check_vma_struct+0x29f>
c01059e6:	c7 44 24 0c 56 b3 10 	movl   $0xc010b356,0xc(%esp)
c01059ed:	c0 
c01059ee:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c01059f5:	c0 
c01059f6:	c7 44 24 04 d0 00 00 	movl   $0xd0,0x4(%esp)
c01059fd:	00 
c01059fe:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105a05:	e8 33 aa ff ff       	call   c010043d <__panic>
        struct vma_struct *vma3 = find_vma(mm, i+2);
c0105a0a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105a0d:	83 c0 02             	add    $0x2,%eax
c0105a10:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105a14:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105a17:	89 04 24             	mov    %eax,(%esp)
c0105a1a:	e8 07 fa ff ff       	call   c0105426 <find_vma>
c0105a1f:	89 45 d0             	mov    %eax,-0x30(%ebp)
        assert(vma3 == NULL);
c0105a22:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c0105a26:	74 24                	je     c0105a4c <check_vma_struct+0x2e1>
c0105a28:	c7 44 24 0c 63 b3 10 	movl   $0xc010b363,0xc(%esp)
c0105a2f:	c0 
c0105a30:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105a37:	c0 
c0105a38:	c7 44 24 04 d2 00 00 	movl   $0xd2,0x4(%esp)
c0105a3f:	00 
c0105a40:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105a47:	e8 f1 a9 ff ff       	call   c010043d <__panic>
        struct vma_struct *vma4 = find_vma(mm, i+3);
c0105a4c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105a4f:	83 c0 03             	add    $0x3,%eax
c0105a52:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105a56:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105a59:	89 04 24             	mov    %eax,(%esp)
c0105a5c:	e8 c5 f9 ff ff       	call   c0105426 <find_vma>
c0105a61:	89 45 cc             	mov    %eax,-0x34(%ebp)
        assert(vma4 == NULL);
c0105a64:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0105a68:	74 24                	je     c0105a8e <check_vma_struct+0x323>
c0105a6a:	c7 44 24 0c 70 b3 10 	movl   $0xc010b370,0xc(%esp)
c0105a71:	c0 
c0105a72:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105a79:	c0 
c0105a7a:	c7 44 24 04 d4 00 00 	movl   $0xd4,0x4(%esp)
c0105a81:	00 
c0105a82:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105a89:	e8 af a9 ff ff       	call   c010043d <__panic>
        struct vma_struct *vma5 = find_vma(mm, i+4);
c0105a8e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105a91:	83 c0 04             	add    $0x4,%eax
c0105a94:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105a98:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105a9b:	89 04 24             	mov    %eax,(%esp)
c0105a9e:	e8 83 f9 ff ff       	call   c0105426 <find_vma>
c0105aa3:	89 45 c8             	mov    %eax,-0x38(%ebp)
        assert(vma5 == NULL);
c0105aa6:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c0105aaa:	74 24                	je     c0105ad0 <check_vma_struct+0x365>
c0105aac:	c7 44 24 0c 7d b3 10 	movl   $0xc010b37d,0xc(%esp)
c0105ab3:	c0 
c0105ab4:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105abb:	c0 
c0105abc:	c7 44 24 04 d6 00 00 	movl   $0xd6,0x4(%esp)
c0105ac3:	00 
c0105ac4:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105acb:	e8 6d a9 ff ff       	call   c010043d <__panic>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
c0105ad0:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0105ad3:	8b 50 04             	mov    0x4(%eax),%edx
c0105ad6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105ad9:	39 c2                	cmp    %eax,%edx
c0105adb:	75 10                	jne    c0105aed <check_vma_struct+0x382>
c0105add:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0105ae0:	8b 40 08             	mov    0x8(%eax),%eax
c0105ae3:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105ae6:	83 c2 02             	add    $0x2,%edx
c0105ae9:	39 d0                	cmp    %edx,%eax
c0105aeb:	74 24                	je     c0105b11 <check_vma_struct+0x3a6>
c0105aed:	c7 44 24 0c 8c b3 10 	movl   $0xc010b38c,0xc(%esp)
c0105af4:	c0 
c0105af5:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105afc:	c0 
c0105afd:	c7 44 24 04 d8 00 00 	movl   $0xd8,0x4(%esp)
c0105b04:	00 
c0105b05:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105b0c:	e8 2c a9 ff ff       	call   c010043d <__panic>
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
c0105b11:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0105b14:	8b 50 04             	mov    0x4(%eax),%edx
c0105b17:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b1a:	39 c2                	cmp    %eax,%edx
c0105b1c:	75 10                	jne    c0105b2e <check_vma_struct+0x3c3>
c0105b1e:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0105b21:	8b 40 08             	mov    0x8(%eax),%eax
c0105b24:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105b27:	83 c2 02             	add    $0x2,%edx
c0105b2a:	39 d0                	cmp    %edx,%eax
c0105b2c:	74 24                	je     c0105b52 <check_vma_struct+0x3e7>
c0105b2e:	c7 44 24 0c bc b3 10 	movl   $0xc010b3bc,0xc(%esp)
c0105b35:	c0 
c0105b36:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105b3d:	c0 
c0105b3e:	c7 44 24 04 d9 00 00 	movl   $0xd9,0x4(%esp)
c0105b45:	00 
c0105b46:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105b4d:	e8 eb a8 ff ff       	call   c010043d <__panic>
    for (i = 5; i <= 5 * step2; i +=5) {
c0105b52:	83 45 f4 05          	addl   $0x5,-0xc(%ebp)
c0105b56:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105b59:	89 d0                	mov    %edx,%eax
c0105b5b:	c1 e0 02             	shl    $0x2,%eax
c0105b5e:	01 d0                	add    %edx,%eax
c0105b60:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0105b63:	0f 8e 22 fe ff ff    	jle    c010598b <check_vma_struct+0x220>
    }

    for (i =4; i>=0; i--) {
c0105b69:	c7 45 f4 04 00 00 00 	movl   $0x4,-0xc(%ebp)
c0105b70:	eb 6f                	jmp    c0105be1 <check_vma_struct+0x476>
        struct vma_struct *vma_below_5= find_vma(mm,i);
c0105b72:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b75:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105b79:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105b7c:	89 04 24             	mov    %eax,(%esp)
c0105b7f:	e8 a2 f8 ff ff       	call   c0105426 <find_vma>
c0105b84:	89 45 dc             	mov    %eax,-0x24(%ebp)
        if (vma_below_5 != NULL ) {
c0105b87:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0105b8b:	74 27                	je     c0105bb4 <check_vma_struct+0x449>
           cprintf("vma_below_5: i %x, start %x, end %x\n",i, vma_below_5->vm_start, vma_below_5->vm_end); 
c0105b8d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105b90:	8b 50 08             	mov    0x8(%eax),%edx
c0105b93:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105b96:	8b 40 04             	mov    0x4(%eax),%eax
c0105b99:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0105b9d:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105ba1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105ba4:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105ba8:	c7 04 24 ec b3 10 c0 	movl   $0xc010b3ec,(%esp)
c0105baf:	e8 1d a7 ff ff       	call   c01002d1 <cprintf>
        }
        assert(vma_below_5 == NULL);
c0105bb4:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0105bb8:	74 24                	je     c0105bde <check_vma_struct+0x473>
c0105bba:	c7 44 24 0c 11 b4 10 	movl   $0xc010b411,0xc(%esp)
c0105bc1:	c0 
c0105bc2:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105bc9:	c0 
c0105bca:	c7 44 24 04 e1 00 00 	movl   $0xe1,0x4(%esp)
c0105bd1:	00 
c0105bd2:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105bd9:	e8 5f a8 ff ff       	call   c010043d <__panic>
    for (i =4; i>=0; i--) {
c0105bde:	ff 4d f4             	decl   -0xc(%ebp)
c0105be1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105be5:	79 8b                	jns    c0105b72 <check_vma_struct+0x407>
    }

    mm_destroy(mm);
c0105be7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105bea:	89 04 24             	mov    %eax,(%esp)
c0105bed:	e8 c6 fa ff ff       	call   c01056b8 <mm_destroy>

    cprintf("check_vma_struct() succeeded!\n");
c0105bf2:	c7 04 24 28 b4 10 c0 	movl   $0xc010b428,(%esp)
c0105bf9:	e8 d3 a6 ff ff       	call   c01002d1 <cprintf>
}
c0105bfe:	90                   	nop
c0105bff:	c9                   	leave  
c0105c00:	c3                   	ret    

c0105c01 <check_pgfault>:

struct mm_struct *check_mm_struct;

// check_pgfault - check correctness of pgfault handler
static void
check_pgfault(void) {
c0105c01:	f3 0f 1e fb          	endbr32 
c0105c05:	55                   	push   %ebp
c0105c06:	89 e5                	mov    %esp,%ebp
c0105c08:	83 ec 38             	sub    $0x38,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0105c0b:	e8 dd da ff ff       	call   c01036ed <nr_free_pages>
c0105c10:	89 45 ec             	mov    %eax,-0x14(%ebp)

    check_mm_struct = mm_create();
c0105c13:	e8 52 f7 ff ff       	call   c010536a <mm_create>
c0105c18:	a3 6c e0 12 c0       	mov    %eax,0xc012e06c
    assert(check_mm_struct != NULL);
c0105c1d:	a1 6c e0 12 c0       	mov    0xc012e06c,%eax
c0105c22:	85 c0                	test   %eax,%eax
c0105c24:	75 24                	jne    c0105c4a <check_pgfault+0x49>
c0105c26:	c7 44 24 0c 47 b4 10 	movl   $0xc010b447,0xc(%esp)
c0105c2d:	c0 
c0105c2e:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105c35:	c0 
c0105c36:	c7 44 24 04 f1 00 00 	movl   $0xf1,0x4(%esp)
c0105c3d:	00 
c0105c3e:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105c45:	e8 f3 a7 ff ff       	call   c010043d <__panic>

    struct mm_struct *mm = check_mm_struct;
c0105c4a:	a1 6c e0 12 c0       	mov    0xc012e06c,%eax
c0105c4f:	89 45 e8             	mov    %eax,-0x18(%ebp)
    pde_t *pgdir = mm->pgdir = boot_pgdir;
c0105c52:	8b 15 e0 89 12 c0    	mov    0xc01289e0,%edx
c0105c58:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105c5b:	89 50 0c             	mov    %edx,0xc(%eax)
c0105c5e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105c61:	8b 40 0c             	mov    0xc(%eax),%eax
c0105c64:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(pgdir[0] == 0);
c0105c67:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105c6a:	8b 00                	mov    (%eax),%eax
c0105c6c:	85 c0                	test   %eax,%eax
c0105c6e:	74 24                	je     c0105c94 <check_pgfault+0x93>
c0105c70:	c7 44 24 0c 5f b4 10 	movl   $0xc010b45f,0xc(%esp)
c0105c77:	c0 
c0105c78:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105c7f:	c0 
c0105c80:	c7 44 24 04 f5 00 00 	movl   $0xf5,0x4(%esp)
c0105c87:	00 
c0105c88:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105c8f:	e8 a9 a7 ff ff       	call   c010043d <__panic>

    struct vma_struct *vma = vma_create(0, PTSIZE, VM_WRITE);
c0105c94:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
c0105c9b:	00 
c0105c9c:	c7 44 24 04 00 00 40 	movl   $0x400000,0x4(%esp)
c0105ca3:	00 
c0105ca4:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0105cab:	e8 37 f7 ff ff       	call   c01053e7 <vma_create>
c0105cb0:	89 45 e0             	mov    %eax,-0x20(%ebp)
    assert(vma != NULL);
c0105cb3:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0105cb7:	75 24                	jne    c0105cdd <check_pgfault+0xdc>
c0105cb9:	c7 44 24 0c f0 b2 10 	movl   $0xc010b2f0,0xc(%esp)
c0105cc0:	c0 
c0105cc1:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105cc8:	c0 
c0105cc9:	c7 44 24 04 f8 00 00 	movl   $0xf8,0x4(%esp)
c0105cd0:	00 
c0105cd1:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105cd8:	e8 60 a7 ff ff       	call   c010043d <__panic>

    insert_vma_struct(mm, vma);
c0105cdd:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105ce0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105ce4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105ce7:	89 04 24             	mov    %eax,(%esp)
c0105cea:	e8 91 f8 ff ff       	call   c0105580 <insert_vma_struct>

    uintptr_t addr = 0x100;
c0105cef:	c7 45 dc 00 01 00 00 	movl   $0x100,-0x24(%ebp)
    assert(find_vma(mm, addr) == vma);
c0105cf6:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105cf9:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105cfd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105d00:	89 04 24             	mov    %eax,(%esp)
c0105d03:	e8 1e f7 ff ff       	call   c0105426 <find_vma>
c0105d08:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0105d0b:	74 24                	je     c0105d31 <check_pgfault+0x130>
c0105d0d:	c7 44 24 0c 6d b4 10 	movl   $0xc010b46d,0xc(%esp)
c0105d14:	c0 
c0105d15:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105d1c:	c0 
c0105d1d:	c7 44 24 04 fd 00 00 	movl   $0xfd,0x4(%esp)
c0105d24:	00 
c0105d25:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105d2c:	e8 0c a7 ff ff       	call   c010043d <__panic>

    int i, sum = 0;
c0105d31:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0105d38:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0105d3f:	eb 16                	jmp    c0105d57 <check_pgfault+0x156>
        *(char *)(addr + i) = i;
c0105d41:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105d44:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105d47:	01 d0                	add    %edx,%eax
c0105d49:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105d4c:	88 10                	mov    %dl,(%eax)
        sum += i;
c0105d4e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105d51:	01 45 f0             	add    %eax,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0105d54:	ff 45 f4             	incl   -0xc(%ebp)
c0105d57:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0105d5b:	7e e4                	jle    c0105d41 <check_pgfault+0x140>
    }
    for (i = 0; i < 100; i ++) {
c0105d5d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0105d64:	eb 14                	jmp    c0105d7a <check_pgfault+0x179>
        sum -= *(char *)(addr + i);
c0105d66:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105d69:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105d6c:	01 d0                	add    %edx,%eax
c0105d6e:	0f b6 00             	movzbl (%eax),%eax
c0105d71:	0f be c0             	movsbl %al,%eax
c0105d74:	29 45 f0             	sub    %eax,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0105d77:	ff 45 f4             	incl   -0xc(%ebp)
c0105d7a:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0105d7e:	7e e6                	jle    c0105d66 <check_pgfault+0x165>
    }
    assert(sum == 0);
c0105d80:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105d84:	74 24                	je     c0105daa <check_pgfault+0x1a9>
c0105d86:	c7 44 24 0c 87 b4 10 	movl   $0xc010b487,0xc(%esp)
c0105d8d:	c0 
c0105d8e:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105d95:	c0 
c0105d96:	c7 44 24 04 07 01 00 	movl   $0x107,0x4(%esp)
c0105d9d:	00 
c0105d9e:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105da5:	e8 93 a6 ff ff       	call   c010043d <__panic>

    page_remove(pgdir, ROUNDDOWN(addr, PGSIZE));
c0105daa:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105dad:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0105db0:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0105db3:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105db8:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105dbc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105dbf:	89 04 24             	mov    %eax,(%esp)
c0105dc2:	e8 51 e1 ff ff       	call   c0103f18 <page_remove>
    free_page(pde2page(pgdir[0]));
c0105dc7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105dca:	8b 00                	mov    (%eax),%eax
c0105dcc:	89 04 24             	mov    %eax,(%esp)
c0105dcf:	e8 7e f5 ff ff       	call   c0105352 <pde2page>
c0105dd4:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0105ddb:	00 
c0105ddc:	89 04 24             	mov    %eax,(%esp)
c0105ddf:	e8 d2 d8 ff ff       	call   c01036b6 <free_pages>
    pgdir[0] = 0;
c0105de4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105de7:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    mm->pgdir = NULL;
c0105ded:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105df0:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    mm_destroy(mm);
c0105df7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105dfa:	89 04 24             	mov    %eax,(%esp)
c0105dfd:	e8 b6 f8 ff ff       	call   c01056b8 <mm_destroy>
    check_mm_struct = NULL;
c0105e02:	c7 05 6c e0 12 c0 00 	movl   $0x0,0xc012e06c
c0105e09:	00 00 00 

    assert(nr_free_pages_store == nr_free_pages());
c0105e0c:	e8 dc d8 ff ff       	call   c01036ed <nr_free_pages>
c0105e11:	39 45 ec             	cmp    %eax,-0x14(%ebp)
c0105e14:	74 24                	je     c0105e3a <check_pgfault+0x239>
c0105e16:	c7 44 24 0c 90 b4 10 	movl   $0xc010b490,0xc(%esp)
c0105e1d:	c0 
c0105e1e:	c7 44 24 08 4f b2 10 	movl   $0xc010b24f,0x8(%esp)
c0105e25:	c0 
c0105e26:	c7 44 24 04 11 01 00 	movl   $0x111,0x4(%esp)
c0105e2d:	00 
c0105e2e:	c7 04 24 64 b2 10 c0 	movl   $0xc010b264,(%esp)
c0105e35:	e8 03 a6 ff ff       	call   c010043d <__panic>

    cprintf("check_pgfault() succeeded!\n");
c0105e3a:	c7 04 24 b7 b4 10 c0 	movl   $0xc010b4b7,(%esp)
c0105e41:	e8 8b a4 ff ff       	call   c01002d1 <cprintf>
}
c0105e46:	90                   	nop
c0105e47:	c9                   	leave  
c0105e48:	c3                   	ret    

c0105e49 <do_pgfault>:
 *            was a read (0) or write (1).
 *         -- The U/S flag (bit 2) indicates whether the processor was executing at user mode (1)
 *            or supervisor mode (0) at the time of the exception.
 */
int
do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
c0105e49:	f3 0f 1e fb          	endbr32 
c0105e4d:	55                   	push   %ebp
c0105e4e:	89 e5                	mov    %esp,%ebp
c0105e50:	83 ec 38             	sub    $0x38,%esp
    int ret = -E_INVAL;
c0105e53:	c7 45 f4 fd ff ff ff 	movl   $0xfffffffd,-0xc(%ebp)
    //try to find a vma which include addr
    struct vma_struct *vma = find_vma(mm, addr);
c0105e5a:	8b 45 10             	mov    0x10(%ebp),%eax
c0105e5d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105e61:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e64:	89 04 24             	mov    %eax,(%esp)
c0105e67:	e8 ba f5 ff ff       	call   c0105426 <find_vma>
c0105e6c:	89 45 ec             	mov    %eax,-0x14(%ebp)

    pgfault_num++;
c0105e6f:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0105e74:	40                   	inc    %eax
c0105e75:	a3 0c c0 12 c0       	mov    %eax,0xc012c00c
    //If the addr is in the range of a mm's vma?
    if (vma == NULL || vma->vm_start > addr) {
c0105e7a:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0105e7e:	74 0b                	je     c0105e8b <do_pgfault+0x42>
c0105e80:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105e83:	8b 40 04             	mov    0x4(%eax),%eax
c0105e86:	39 45 10             	cmp    %eax,0x10(%ebp)
c0105e89:	73 18                	jae    c0105ea3 <do_pgfault+0x5a>
        cprintf("not valid addr %x, and  can not find it in vma\n", addr);
c0105e8b:	8b 45 10             	mov    0x10(%ebp),%eax
c0105e8e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105e92:	c7 04 24 d4 b4 10 c0 	movl   $0xc010b4d4,(%esp)
c0105e99:	e8 33 a4 ff ff       	call   c01002d1 <cprintf>
        goto failed;
c0105e9e:	e9 95 01 00 00       	jmp    c0106038 <do_pgfault+0x1ef>
    }
    //check the error_code
    switch (error_code & 3) {
c0105ea3:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105ea6:	83 e0 03             	and    $0x3,%eax
c0105ea9:	85 c0                	test   %eax,%eax
c0105eab:	74 34                	je     c0105ee1 <do_pgfault+0x98>
c0105ead:	83 f8 01             	cmp    $0x1,%eax
c0105eb0:	74 1e                	je     c0105ed0 <do_pgfault+0x87>
    default:
            /* error code flag : default is 3 ( W/R=1, P=1): write, present */
    case 2: /* error code flag : (W/R=1, P=0): write, not present */
        if (!(vma->vm_flags & VM_WRITE)) {
c0105eb2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105eb5:	8b 40 0c             	mov    0xc(%eax),%eax
c0105eb8:	83 e0 02             	and    $0x2,%eax
c0105ebb:	85 c0                	test   %eax,%eax
c0105ebd:	75 40                	jne    c0105eff <do_pgfault+0xb6>
            cprintf("do_pgfault failed: error code flag = write AND not present, but the addr's vma cannot write\n");
c0105ebf:	c7 04 24 04 b5 10 c0 	movl   $0xc010b504,(%esp)
c0105ec6:	e8 06 a4 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0105ecb:	e9 68 01 00 00       	jmp    c0106038 <do_pgfault+0x1ef>
        }
        break;
    case 1: /* error code flag : (W/R=0, P=1): read, present */
        cprintf("do_pgfault failed: error code flag = read AND present\n");
c0105ed0:	c7 04 24 64 b5 10 c0 	movl   $0xc010b564,(%esp)
c0105ed7:	e8 f5 a3 ff ff       	call   c01002d1 <cprintf>
        goto failed;
c0105edc:	e9 57 01 00 00       	jmp    c0106038 <do_pgfault+0x1ef>
    case 0: /* error code flag : (W/R=0, P=0): read, not present */
        if (!(vma->vm_flags & (VM_READ | VM_EXEC))) {
c0105ee1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105ee4:	8b 40 0c             	mov    0xc(%eax),%eax
c0105ee7:	83 e0 05             	and    $0x5,%eax
c0105eea:	85 c0                	test   %eax,%eax
c0105eec:	75 12                	jne    c0105f00 <do_pgfault+0xb7>
            cprintf("do_pgfault failed: error code flag = read AND not present, but the addr's vma cannot read or exec\n");
c0105eee:	c7 04 24 9c b5 10 c0 	movl   $0xc010b59c,(%esp)
c0105ef5:	e8 d7 a3 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0105efa:	e9 39 01 00 00       	jmp    c0106038 <do_pgfault+0x1ef>
        break;
c0105eff:	90                   	nop
     *    (write an non_existed addr && addr is writable) OR
     *    (read  an non_existed addr && addr is readable)
     * THEN
     *    continue process
     */
    uint32_t perm = PTE_U;
c0105f00:	c7 45 f0 04 00 00 00 	movl   $0x4,-0x10(%ebp)
    if (vma->vm_flags & VM_WRITE) {
c0105f07:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105f0a:	8b 40 0c             	mov    0xc(%eax),%eax
c0105f0d:	83 e0 02             	and    $0x2,%eax
c0105f10:	85 c0                	test   %eax,%eax
c0105f12:	74 04                	je     c0105f18 <do_pgfault+0xcf>
        perm |= PTE_W;
c0105f14:	83 4d f0 02          	orl    $0x2,-0x10(%ebp)
    }
    addr = ROUNDDOWN(addr, PGSIZE);
c0105f18:	8b 45 10             	mov    0x10(%ebp),%eax
c0105f1b:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0105f1e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105f21:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105f26:	89 45 10             	mov    %eax,0x10(%ebp)

    ret = -E_NO_MEM;
c0105f29:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)

    pte_t *ptep=NULL;
c0105f30:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    *   mm->pgdir : the PDT of these vma
    *
    */
    
    /*LAB3 EXERCISE 1: YOUR CODE*/
    if(!(ptep =get_pte(mm->pgdir,addr,1))) goto failed;              //(1) try to find a pte, if pte's PT(Page Table) isn't existed, then create a PT.
c0105f37:	8b 45 08             	mov    0x8(%ebp),%eax
c0105f3a:	8b 40 0c             	mov    0xc(%eax),%eax
c0105f3d:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0105f44:	00 
c0105f45:	8b 55 10             	mov    0x10(%ebp),%edx
c0105f48:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105f4c:	89 04 24             	mov    %eax,(%esp)
c0105f4f:	e8 c3 dd ff ff       	call   c0103d17 <get_pte>
c0105f54:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0105f57:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0105f5b:	0f 84 d3 00 00 00    	je     c0106034 <do_pgfault+0x1eb>
    if (*ptep == 0) {
c0105f61:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105f64:	8b 00                	mov    (%eax),%eax
c0105f66:	85 c0                	test   %eax,%eax
c0105f68:	75 29                	jne    c0105f93 <do_pgfault+0x14a>
        if(pgdir_alloc_page(mm->pgdir,addr,perm)==NULL)
c0105f6a:	8b 45 08             	mov    0x8(%ebp),%eax
c0105f6d:	8b 40 0c             	mov    0xc(%eax),%eax
c0105f70:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0105f73:	89 54 24 08          	mov    %edx,0x8(%esp)
c0105f77:	8b 55 10             	mov    0x10(%ebp),%edx
c0105f7a:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105f7e:	89 04 24             	mov    %eax,(%esp)
c0105f81:	e8 f9 e0 ff ff       	call   c010407f <pgdir_alloc_page>
c0105f86:	85 c0                	test   %eax,%eax
c0105f88:	0f 85 9d 00 00 00    	jne    c010602b <do_pgfault+0x1e2>
	    goto failed;         //(2) if the phy addr isn't exist, then alloc a page & map the phy addr with logical addr
c0105f8e:	e9 a5 00 00 00       	jmp    c0106038 <do_pgfault+0x1ef>
    *    swap_in(mm, addr, &page) : alloc a memory page, then according to the swap entry in PTE for addr,
    *                               find the addr of disk page, read the content of disk page into this memroy page
    *    page_insert ： build the map of phy addr of an Page with the linear addr la
    *    swap_map_swappable ： set the page swappable
    */
        if(swap_init_ok) {
c0105f93:	a1 14 c0 12 c0       	mov    0xc012c014,%eax
c0105f98:	85 c0                	test   %eax,%eax
c0105f9a:	74 78                	je     c0106014 <do_pgfault+0x1cb>
            struct Page *page=NULL;
c0105f9c:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
            if(ret=swap_in(mm,addr,&page)) goto failed; //(1）According to the mm AND addr, try to load the content of right disk page
c0105fa3:	8d 45 e0             	lea    -0x20(%ebp),%eax
c0105fa6:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105faa:	8b 45 10             	mov    0x10(%ebp),%eax
c0105fad:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105fb1:	8b 45 08             	mov    0x8(%ebp),%eax
c0105fb4:	89 04 24             	mov    %eax,(%esp)
c0105fb7:	e8 22 0b 00 00       	call   c0106ade <swap_in>
c0105fbc:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105fbf:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105fc3:	75 72                	jne    c0106037 <do_pgfault+0x1ee>
                                    //    into the memory which page managed.
            page_insert(mm->pgdir,page,addr,perm);                        //(2) According to the mm, addr AND page, setup the map of phy addr <---> logical addr
c0105fc5:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105fc8:	8b 45 08             	mov    0x8(%ebp),%eax
c0105fcb:	8b 40 0c             	mov    0xc(%eax),%eax
c0105fce:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0105fd1:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0105fd5:	8b 4d 10             	mov    0x10(%ebp),%ecx
c0105fd8:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0105fdc:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105fe0:	89 04 24             	mov    %eax,(%esp)
c0105fe3:	e8 79 df ff ff       	call   c0103f61 <page_insert>
            swap_map_swappable(mm,addr,page,1);//(3) make the page swappable.
c0105fe8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105feb:	c7 44 24 0c 01 00 00 	movl   $0x1,0xc(%esp)
c0105ff2:	00 
c0105ff3:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105ff7:	8b 45 10             	mov    0x10(%ebp),%eax
c0105ffa:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105ffe:	8b 45 08             	mov    0x8(%ebp),%eax
c0106001:	89 04 24             	mov    %eax,(%esp)
c0106004:	e8 07 09 00 00       	call   c0106910 <swap_map_swappable>
            page->pra_vaddr=addr;
c0106009:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010600c:	8b 55 10             	mov    0x10(%ebp),%edx
c010600f:	89 50 1c             	mov    %edx,0x1c(%eax)
c0106012:	eb 17                	jmp    c010602b <do_pgfault+0x1e2>
        }
        else {
            cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
c0106014:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106017:	8b 00                	mov    (%eax),%eax
c0106019:	89 44 24 04          	mov    %eax,0x4(%esp)
c010601d:	c7 04 24 00 b6 10 c0 	movl   $0xc010b600,(%esp)
c0106024:	e8 a8 a2 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0106029:	eb 0d                	jmp    c0106038 <do_pgfault+0x1ef>
        }
   }
   ret = 0;
c010602b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0106032:	eb 04                	jmp    c0106038 <do_pgfault+0x1ef>
    if(!(ptep =get_pte(mm->pgdir,addr,1))) goto failed;              //(1) try to find a pte, if pte's PT(Page Table) isn't existed, then create a PT.
c0106034:	90                   	nop
c0106035:	eb 01                	jmp    c0106038 <do_pgfault+0x1ef>
            if(ret=swap_in(mm,addr,&page)) goto failed; //(1）According to the mm AND addr, try to load the content of right disk page
c0106037:	90                   	nop
failed:
    return ret;
c0106038:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010603b:	c9                   	leave  
c010603c:	c3                   	ret    

c010603d <__intr_save>:
__intr_save(void) {
c010603d:	55                   	push   %ebp
c010603e:	89 e5                	mov    %esp,%ebp
c0106040:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0106043:	9c                   	pushf  
c0106044:	58                   	pop    %eax
c0106045:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0106048:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c010604b:	25 00 02 00 00       	and    $0x200,%eax
c0106050:	85 c0                	test   %eax,%eax
c0106052:	74 0c                	je     c0106060 <__intr_save+0x23>
        intr_disable();
c0106054:	e8 ab c1 ff ff       	call   c0102204 <intr_disable>
        return 1;
c0106059:	b8 01 00 00 00       	mov    $0x1,%eax
c010605e:	eb 05                	jmp    c0106065 <__intr_save+0x28>
    return 0;
c0106060:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106065:	c9                   	leave  
c0106066:	c3                   	ret    

c0106067 <__intr_restore>:
__intr_restore(bool flag) {
c0106067:	55                   	push   %ebp
c0106068:	89 e5                	mov    %esp,%ebp
c010606a:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c010606d:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0106071:	74 05                	je     c0106078 <__intr_restore+0x11>
        intr_enable();
c0106073:	e8 80 c1 ff ff       	call   c01021f8 <intr_enable>
}
c0106078:	90                   	nop
c0106079:	c9                   	leave  
c010607a:	c3                   	ret    

c010607b <page2ppn>:
page2ppn(struct Page *page) {
c010607b:	55                   	push   %ebp
c010607c:	89 e5                	mov    %esp,%ebp
    return page - pages;
c010607e:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c0106083:	8b 55 08             	mov    0x8(%ebp),%edx
c0106086:	29 c2                	sub    %eax,%edx
c0106088:	89 d0                	mov    %edx,%eax
c010608a:	c1 f8 05             	sar    $0x5,%eax
}
c010608d:	5d                   	pop    %ebp
c010608e:	c3                   	ret    

c010608f <page2pa>:
page2pa(struct Page *page) {
c010608f:	55                   	push   %ebp
c0106090:	89 e5                	mov    %esp,%ebp
c0106092:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0106095:	8b 45 08             	mov    0x8(%ebp),%eax
c0106098:	89 04 24             	mov    %eax,(%esp)
c010609b:	e8 db ff ff ff       	call   c010607b <page2ppn>
c01060a0:	c1 e0 0c             	shl    $0xc,%eax
}
c01060a3:	c9                   	leave  
c01060a4:	c3                   	ret    

c01060a5 <pa2page>:
pa2page(uintptr_t pa) {
c01060a5:	55                   	push   %ebp
c01060a6:	89 e5                	mov    %esp,%ebp
c01060a8:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c01060ab:	8b 45 08             	mov    0x8(%ebp),%eax
c01060ae:	c1 e8 0c             	shr    $0xc,%eax
c01060b1:	89 c2                	mov    %eax,%edx
c01060b3:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c01060b8:	39 c2                	cmp    %eax,%edx
c01060ba:	72 1c                	jb     c01060d8 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c01060bc:	c7 44 24 08 28 b6 10 	movl   $0xc010b628,0x8(%esp)
c01060c3:	c0 
c01060c4:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c01060cb:	00 
c01060cc:	c7 04 24 47 b6 10 c0 	movl   $0xc010b647,(%esp)
c01060d3:	e8 65 a3 ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c01060d8:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c01060dd:	8b 55 08             	mov    0x8(%ebp),%edx
c01060e0:	c1 ea 0c             	shr    $0xc,%edx
c01060e3:	c1 e2 05             	shl    $0x5,%edx
c01060e6:	01 d0                	add    %edx,%eax
}
c01060e8:	c9                   	leave  
c01060e9:	c3                   	ret    

c01060ea <page2kva>:
page2kva(struct Page *page) {
c01060ea:	55                   	push   %ebp
c01060eb:	89 e5                	mov    %esp,%ebp
c01060ed:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01060f0:	8b 45 08             	mov    0x8(%ebp),%eax
c01060f3:	89 04 24             	mov    %eax,(%esp)
c01060f6:	e8 94 ff ff ff       	call   c010608f <page2pa>
c01060fb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01060fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106101:	c1 e8 0c             	shr    $0xc,%eax
c0106104:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106107:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c010610c:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c010610f:	72 23                	jb     c0106134 <page2kva+0x4a>
c0106111:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106114:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106118:	c7 44 24 08 58 b6 10 	movl   $0xc010b658,0x8(%esp)
c010611f:	c0 
c0106120:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0106127:	00 
c0106128:	c7 04 24 47 b6 10 c0 	movl   $0xc010b647,(%esp)
c010612f:	e8 09 a3 ff ff       	call   c010043d <__panic>
c0106134:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106137:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c010613c:	c9                   	leave  
c010613d:	c3                   	ret    

c010613e <kva2page>:
kva2page(void *kva) {
c010613e:	55                   	push   %ebp
c010613f:	89 e5                	mov    %esp,%ebp
c0106141:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c0106144:	8b 45 08             	mov    0x8(%ebp),%eax
c0106147:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010614a:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0106151:	77 23                	ja     c0106176 <kva2page+0x38>
c0106153:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106156:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010615a:	c7 44 24 08 7c b6 10 	movl   $0xc010b67c,0x8(%esp)
c0106161:	c0 
c0106162:	c7 44 24 04 6b 00 00 	movl   $0x6b,0x4(%esp)
c0106169:	00 
c010616a:	c7 04 24 47 b6 10 c0 	movl   $0xc010b647,(%esp)
c0106171:	e8 c7 a2 ff ff       	call   c010043d <__panic>
c0106176:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106179:	05 00 00 00 40       	add    $0x40000000,%eax
c010617e:	89 04 24             	mov    %eax,(%esp)
c0106181:	e8 1f ff ff ff       	call   c01060a5 <pa2page>
}
c0106186:	c9                   	leave  
c0106187:	c3                   	ret    

c0106188 <__slob_get_free_pages>:
static slob_t *slobfree = &arena;
static bigblock_t *bigblocks;


static void* __slob_get_free_pages(gfp_t gfp, int order)
{
c0106188:	f3 0f 1e fb          	endbr32 
c010618c:	55                   	push   %ebp
c010618d:	89 e5                	mov    %esp,%ebp
c010618f:	83 ec 28             	sub    $0x28,%esp
  struct Page * page = alloc_pages(1 << order);
c0106192:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106195:	ba 01 00 00 00       	mov    $0x1,%edx
c010619a:	88 c1                	mov    %al,%cl
c010619c:	d3 e2                	shl    %cl,%edx
c010619e:	89 d0                	mov    %edx,%eax
c01061a0:	89 04 24             	mov    %eax,(%esp)
c01061a3:	e8 9f d4 ff ff       	call   c0103647 <alloc_pages>
c01061a8:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(!page)
c01061ab:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01061af:	75 07                	jne    c01061b8 <__slob_get_free_pages+0x30>
    return NULL;
c01061b1:	b8 00 00 00 00       	mov    $0x0,%eax
c01061b6:	eb 0b                	jmp    c01061c3 <__slob_get_free_pages+0x3b>
  return page2kva(page);
c01061b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01061bb:	89 04 24             	mov    %eax,(%esp)
c01061be:	e8 27 ff ff ff       	call   c01060ea <page2kva>
}
c01061c3:	c9                   	leave  
c01061c4:	c3                   	ret    

c01061c5 <__slob_free_pages>:

#define __slob_get_free_page(gfp) __slob_get_free_pages(gfp, 0)

static inline void __slob_free_pages(unsigned long kva, int order)
{
c01061c5:	55                   	push   %ebp
c01061c6:	89 e5                	mov    %esp,%ebp
c01061c8:	53                   	push   %ebx
c01061c9:	83 ec 14             	sub    $0x14,%esp
  free_pages(kva2page(kva), 1 << order);
c01061cc:	8b 45 0c             	mov    0xc(%ebp),%eax
c01061cf:	ba 01 00 00 00       	mov    $0x1,%edx
c01061d4:	88 c1                	mov    %al,%cl
c01061d6:	d3 e2                	shl    %cl,%edx
c01061d8:	89 d0                	mov    %edx,%eax
c01061da:	89 c3                	mov    %eax,%ebx
c01061dc:	8b 45 08             	mov    0x8(%ebp),%eax
c01061df:	89 04 24             	mov    %eax,(%esp)
c01061e2:	e8 57 ff ff ff       	call   c010613e <kva2page>
c01061e7:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c01061eb:	89 04 24             	mov    %eax,(%esp)
c01061ee:	e8 c3 d4 ff ff       	call   c01036b6 <free_pages>
}
c01061f3:	90                   	nop
c01061f4:	83 c4 14             	add    $0x14,%esp
c01061f7:	5b                   	pop    %ebx
c01061f8:	5d                   	pop    %ebp
c01061f9:	c3                   	ret    

c01061fa <slob_alloc>:

static void slob_free(void *b, int size);

static void *slob_alloc(size_t size, gfp_t gfp, int align)
{
c01061fa:	f3 0f 1e fb          	endbr32 
c01061fe:	55                   	push   %ebp
c01061ff:	89 e5                	mov    %esp,%ebp
c0106201:	83 ec 38             	sub    $0x38,%esp
  assert( (size + SLOB_UNIT) < PAGE_SIZE );
c0106204:	8b 45 08             	mov    0x8(%ebp),%eax
c0106207:	83 c0 08             	add    $0x8,%eax
c010620a:	3d ff 0f 00 00       	cmp    $0xfff,%eax
c010620f:	76 24                	jbe    c0106235 <slob_alloc+0x3b>
c0106211:	c7 44 24 0c a0 b6 10 	movl   $0xc010b6a0,0xc(%esp)
c0106218:	c0 
c0106219:	c7 44 24 08 bf b6 10 	movl   $0xc010b6bf,0x8(%esp)
c0106220:	c0 
c0106221:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c0106228:	00 
c0106229:	c7 04 24 d4 b6 10 c0 	movl   $0xc010b6d4,(%esp)
c0106230:	e8 08 a2 ff ff       	call   c010043d <__panic>

	slob_t *prev, *cur, *aligned = 0;
c0106235:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
	int delta = 0, units = SLOB_UNITS(size);
c010623c:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0106243:	8b 45 08             	mov    0x8(%ebp),%eax
c0106246:	83 c0 07             	add    $0x7,%eax
c0106249:	c1 e8 03             	shr    $0x3,%eax
c010624c:	89 45 e0             	mov    %eax,-0x20(%ebp)
	unsigned long flags;

	spin_lock_irqsave(&slob_lock, flags);
c010624f:	e8 e9 fd ff ff       	call   c010603d <__intr_save>
c0106254:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	prev = slobfree;
c0106257:	a1 68 8a 12 c0       	mov    0xc0128a68,%eax
c010625c:	89 45 f4             	mov    %eax,-0xc(%ebp)
	for (cur = prev->next; ; prev = cur, cur = cur->next) {
c010625f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106262:	8b 40 04             	mov    0x4(%eax),%eax
c0106265:	89 45 f0             	mov    %eax,-0x10(%ebp)
		if (align) {
c0106268:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010626c:	74 21                	je     c010628f <slob_alloc+0x95>
			aligned = (slob_t *)ALIGN((unsigned long)cur, align);
c010626e:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0106271:	8b 45 10             	mov    0x10(%ebp),%eax
c0106274:	01 d0                	add    %edx,%eax
c0106276:	8d 50 ff             	lea    -0x1(%eax),%edx
c0106279:	8b 45 10             	mov    0x10(%ebp),%eax
c010627c:	f7 d8                	neg    %eax
c010627e:	21 d0                	and    %edx,%eax
c0106280:	89 45 ec             	mov    %eax,-0x14(%ebp)
			delta = aligned - cur;
c0106283:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106286:	2b 45 f0             	sub    -0x10(%ebp),%eax
c0106289:	c1 f8 03             	sar    $0x3,%eax
c010628c:	89 45 e8             	mov    %eax,-0x18(%ebp)
		}
		if (cur->units >= units + delta) { /* room enough? */
c010628f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106292:	8b 00                	mov    (%eax),%eax
c0106294:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c0106297:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010629a:	01 ca                	add    %ecx,%edx
c010629c:	39 d0                	cmp    %edx,%eax
c010629e:	0f 8c aa 00 00 00    	jl     c010634e <slob_alloc+0x154>
			if (delta) { /* need to fragment head to align? */
c01062a4:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01062a8:	74 38                	je     c01062e2 <slob_alloc+0xe8>
				aligned->units = cur->units - delta;
c01062aa:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01062ad:	8b 00                	mov    (%eax),%eax
c01062af:	2b 45 e8             	sub    -0x18(%ebp),%eax
c01062b2:	89 c2                	mov    %eax,%edx
c01062b4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01062b7:	89 10                	mov    %edx,(%eax)
				aligned->next = cur->next;
c01062b9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01062bc:	8b 50 04             	mov    0x4(%eax),%edx
c01062bf:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01062c2:	89 50 04             	mov    %edx,0x4(%eax)
				cur->next = aligned;
c01062c5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01062c8:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01062cb:	89 50 04             	mov    %edx,0x4(%eax)
				cur->units = delta;
c01062ce:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01062d1:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01062d4:	89 10                	mov    %edx,(%eax)
				prev = cur;
c01062d6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01062d9:	89 45 f4             	mov    %eax,-0xc(%ebp)
				cur = aligned;
c01062dc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01062df:	89 45 f0             	mov    %eax,-0x10(%ebp)
			}

			if (cur->units == units) /* exact fit? */
c01062e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01062e5:	8b 00                	mov    (%eax),%eax
c01062e7:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c01062ea:	75 0e                	jne    c01062fa <slob_alloc+0x100>
				prev->next = cur->next; /* unlink */
c01062ec:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01062ef:	8b 50 04             	mov    0x4(%eax),%edx
c01062f2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01062f5:	89 50 04             	mov    %edx,0x4(%eax)
c01062f8:	eb 3c                	jmp    c0106336 <slob_alloc+0x13c>
			else { /* fragment */
				prev->next = cur + units;
c01062fa:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01062fd:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0106304:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106307:	01 c2                	add    %eax,%edx
c0106309:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010630c:	89 50 04             	mov    %edx,0x4(%eax)
				prev->next->units = cur->units - units;
c010630f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106312:	8b 10                	mov    (%eax),%edx
c0106314:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106317:	8b 40 04             	mov    0x4(%eax),%eax
c010631a:	2b 55 e0             	sub    -0x20(%ebp),%edx
c010631d:	89 10                	mov    %edx,(%eax)
				prev->next->next = cur->next;
c010631f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106322:	8b 40 04             	mov    0x4(%eax),%eax
c0106325:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0106328:	8b 52 04             	mov    0x4(%edx),%edx
c010632b:	89 50 04             	mov    %edx,0x4(%eax)
				cur->units = units;
c010632e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106331:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0106334:	89 10                	mov    %edx,(%eax)
			}

			slobfree = prev;
c0106336:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106339:	a3 68 8a 12 c0       	mov    %eax,0xc0128a68
			spin_unlock_irqrestore(&slob_lock, flags);
c010633e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106341:	89 04 24             	mov    %eax,(%esp)
c0106344:	e8 1e fd ff ff       	call   c0106067 <__intr_restore>
			return cur;
c0106349:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010634c:	eb 7f                	jmp    c01063cd <slob_alloc+0x1d3>
		}
		if (cur == slobfree) {
c010634e:	a1 68 8a 12 c0       	mov    0xc0128a68,%eax
c0106353:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0106356:	75 61                	jne    c01063b9 <slob_alloc+0x1bf>
			spin_unlock_irqrestore(&slob_lock, flags);
c0106358:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010635b:	89 04 24             	mov    %eax,(%esp)
c010635e:	e8 04 fd ff ff       	call   c0106067 <__intr_restore>

			if (size == PAGE_SIZE) /* trying to shrink arena? */
c0106363:	81 7d 08 00 10 00 00 	cmpl   $0x1000,0x8(%ebp)
c010636a:	75 07                	jne    c0106373 <slob_alloc+0x179>
				return 0;
c010636c:	b8 00 00 00 00       	mov    $0x0,%eax
c0106371:	eb 5a                	jmp    c01063cd <slob_alloc+0x1d3>

			cur = (slob_t *)__slob_get_free_page(gfp);
c0106373:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010637a:	00 
c010637b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010637e:	89 04 24             	mov    %eax,(%esp)
c0106381:	e8 02 fe ff ff       	call   c0106188 <__slob_get_free_pages>
c0106386:	89 45 f0             	mov    %eax,-0x10(%ebp)
			if (!cur)
c0106389:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010638d:	75 07                	jne    c0106396 <slob_alloc+0x19c>
				return 0;
c010638f:	b8 00 00 00 00       	mov    $0x0,%eax
c0106394:	eb 37                	jmp    c01063cd <slob_alloc+0x1d3>

			slob_free(cur, PAGE_SIZE);
c0106396:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c010639d:	00 
c010639e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01063a1:	89 04 24             	mov    %eax,(%esp)
c01063a4:	e8 26 00 00 00       	call   c01063cf <slob_free>
			spin_lock_irqsave(&slob_lock, flags);
c01063a9:	e8 8f fc ff ff       	call   c010603d <__intr_save>
c01063ae:	89 45 e4             	mov    %eax,-0x1c(%ebp)
			cur = slobfree;
c01063b1:	a1 68 8a 12 c0       	mov    0xc0128a68,%eax
c01063b6:	89 45 f0             	mov    %eax,-0x10(%ebp)
	for (cur = prev->next; ; prev = cur, cur = cur->next) {
c01063b9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01063bc:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01063bf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01063c2:	8b 40 04             	mov    0x4(%eax),%eax
c01063c5:	89 45 f0             	mov    %eax,-0x10(%ebp)
		if (align) {
c01063c8:	e9 9b fe ff ff       	jmp    c0106268 <slob_alloc+0x6e>
		}
	}
}
c01063cd:	c9                   	leave  
c01063ce:	c3                   	ret    

c01063cf <slob_free>:

static void slob_free(void *block, int size)
{
c01063cf:	f3 0f 1e fb          	endbr32 
c01063d3:	55                   	push   %ebp
c01063d4:	89 e5                	mov    %esp,%ebp
c01063d6:	83 ec 28             	sub    $0x28,%esp
	slob_t *cur, *b = (slob_t *)block;
c01063d9:	8b 45 08             	mov    0x8(%ebp),%eax
c01063dc:	89 45 f0             	mov    %eax,-0x10(%ebp)
	unsigned long flags;

	if (!block)
c01063df:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01063e3:	0f 84 01 01 00 00    	je     c01064ea <slob_free+0x11b>
		return;

	if (size)
c01063e9:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01063ed:	74 10                	je     c01063ff <slob_free+0x30>
		b->units = SLOB_UNITS(size);
c01063ef:	8b 45 0c             	mov    0xc(%ebp),%eax
c01063f2:	83 c0 07             	add    $0x7,%eax
c01063f5:	c1 e8 03             	shr    $0x3,%eax
c01063f8:	89 c2                	mov    %eax,%edx
c01063fa:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01063fd:	89 10                	mov    %edx,(%eax)

	/* Find reinsertion point */
	spin_lock_irqsave(&slob_lock, flags);
c01063ff:	e8 39 fc ff ff       	call   c010603d <__intr_save>
c0106404:	89 45 ec             	mov    %eax,-0x14(%ebp)
	for (cur = slobfree; !(b > cur && b < cur->next); cur = cur->next)
c0106407:	a1 68 8a 12 c0       	mov    0xc0128a68,%eax
c010640c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010640f:	eb 27                	jmp    c0106438 <slob_free+0x69>
		if (cur >= cur->next && (b > cur || b < cur->next))
c0106411:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106414:	8b 40 04             	mov    0x4(%eax),%eax
c0106417:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c010641a:	72 13                	jb     c010642f <slob_free+0x60>
c010641c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010641f:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0106422:	77 27                	ja     c010644b <slob_free+0x7c>
c0106424:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106427:	8b 40 04             	mov    0x4(%eax),%eax
c010642a:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c010642d:	72 1c                	jb     c010644b <slob_free+0x7c>
	for (cur = slobfree; !(b > cur && b < cur->next); cur = cur->next)
c010642f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106432:	8b 40 04             	mov    0x4(%eax),%eax
c0106435:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106438:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010643b:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010643e:	76 d1                	jbe    c0106411 <slob_free+0x42>
c0106440:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106443:	8b 40 04             	mov    0x4(%eax),%eax
c0106446:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0106449:	73 c6                	jae    c0106411 <slob_free+0x42>
			break;

	if (b + b->units == cur->next) {
c010644b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010644e:	8b 00                	mov    (%eax),%eax
c0106450:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0106457:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010645a:	01 c2                	add    %eax,%edx
c010645c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010645f:	8b 40 04             	mov    0x4(%eax),%eax
c0106462:	39 c2                	cmp    %eax,%edx
c0106464:	75 25                	jne    c010648b <slob_free+0xbc>
		b->units += cur->next->units;
c0106466:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106469:	8b 10                	mov    (%eax),%edx
c010646b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010646e:	8b 40 04             	mov    0x4(%eax),%eax
c0106471:	8b 00                	mov    (%eax),%eax
c0106473:	01 c2                	add    %eax,%edx
c0106475:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106478:	89 10                	mov    %edx,(%eax)
		b->next = cur->next->next;
c010647a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010647d:	8b 40 04             	mov    0x4(%eax),%eax
c0106480:	8b 50 04             	mov    0x4(%eax),%edx
c0106483:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106486:	89 50 04             	mov    %edx,0x4(%eax)
c0106489:	eb 0c                	jmp    c0106497 <slob_free+0xc8>
	} else
		b->next = cur->next;
c010648b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010648e:	8b 50 04             	mov    0x4(%eax),%edx
c0106491:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106494:	89 50 04             	mov    %edx,0x4(%eax)

	if (cur + cur->units == b) {
c0106497:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010649a:	8b 00                	mov    (%eax),%eax
c010649c:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01064a3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01064a6:	01 d0                	add    %edx,%eax
c01064a8:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01064ab:	75 1f                	jne    c01064cc <slob_free+0xfd>
		cur->units += b->units;
c01064ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01064b0:	8b 10                	mov    (%eax),%edx
c01064b2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01064b5:	8b 00                	mov    (%eax),%eax
c01064b7:	01 c2                	add    %eax,%edx
c01064b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01064bc:	89 10                	mov    %edx,(%eax)
		cur->next = b->next;
c01064be:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01064c1:	8b 50 04             	mov    0x4(%eax),%edx
c01064c4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01064c7:	89 50 04             	mov    %edx,0x4(%eax)
c01064ca:	eb 09                	jmp    c01064d5 <slob_free+0x106>
	} else
		cur->next = b;
c01064cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01064cf:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01064d2:	89 50 04             	mov    %edx,0x4(%eax)

	slobfree = cur;
c01064d5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01064d8:	a3 68 8a 12 c0       	mov    %eax,0xc0128a68

	spin_unlock_irqrestore(&slob_lock, flags);
c01064dd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01064e0:	89 04 24             	mov    %eax,(%esp)
c01064e3:	e8 7f fb ff ff       	call   c0106067 <__intr_restore>
c01064e8:	eb 01                	jmp    c01064eb <slob_free+0x11c>
		return;
c01064ea:	90                   	nop
}
c01064eb:	c9                   	leave  
c01064ec:	c3                   	ret    

c01064ed <slob_init>:



void
slob_init(void) {
c01064ed:	f3 0f 1e fb          	endbr32 
c01064f1:	55                   	push   %ebp
c01064f2:	89 e5                	mov    %esp,%ebp
c01064f4:	83 ec 18             	sub    $0x18,%esp
  cprintf("use SLOB allocator\n");
c01064f7:	c7 04 24 e6 b6 10 c0 	movl   $0xc010b6e6,(%esp)
c01064fe:	e8 ce 9d ff ff       	call   c01002d1 <cprintf>
}
c0106503:	90                   	nop
c0106504:	c9                   	leave  
c0106505:	c3                   	ret    

c0106506 <kmalloc_init>:

inline void 
kmalloc_init(void) {
c0106506:	f3 0f 1e fb          	endbr32 
c010650a:	55                   	push   %ebp
c010650b:	89 e5                	mov    %esp,%ebp
c010650d:	83 ec 18             	sub    $0x18,%esp
    slob_init();
c0106510:	e8 d8 ff ff ff       	call   c01064ed <slob_init>
    cprintf("kmalloc_init() succeeded!\n");
c0106515:	c7 04 24 fa b6 10 c0 	movl   $0xc010b6fa,(%esp)
c010651c:	e8 b0 9d ff ff       	call   c01002d1 <cprintf>
}
c0106521:	90                   	nop
c0106522:	c9                   	leave  
c0106523:	c3                   	ret    

c0106524 <slob_allocated>:

size_t
slob_allocated(void) {
c0106524:	f3 0f 1e fb          	endbr32 
c0106528:	55                   	push   %ebp
c0106529:	89 e5                	mov    %esp,%ebp
  return 0;
c010652b:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106530:	5d                   	pop    %ebp
c0106531:	c3                   	ret    

c0106532 <kallocated>:

size_t
kallocated(void) {
c0106532:	f3 0f 1e fb          	endbr32 
c0106536:	55                   	push   %ebp
c0106537:	89 e5                	mov    %esp,%ebp
   return slob_allocated();
c0106539:	e8 e6 ff ff ff       	call   c0106524 <slob_allocated>
}
c010653e:	5d                   	pop    %ebp
c010653f:	c3                   	ret    

c0106540 <find_order>:

static int find_order(int size)
{
c0106540:	f3 0f 1e fb          	endbr32 
c0106544:	55                   	push   %ebp
c0106545:	89 e5                	mov    %esp,%ebp
c0106547:	83 ec 10             	sub    $0x10,%esp
	int order = 0;
c010654a:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
	for ( ; size > 4096 ; size >>=1)
c0106551:	eb 06                	jmp    c0106559 <find_order+0x19>
		order++;
c0106553:	ff 45 fc             	incl   -0x4(%ebp)
	for ( ; size > 4096 ; size >>=1)
c0106556:	d1 7d 08             	sarl   0x8(%ebp)
c0106559:	81 7d 08 00 10 00 00 	cmpl   $0x1000,0x8(%ebp)
c0106560:	7f f1                	jg     c0106553 <find_order+0x13>
	return order;
c0106562:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0106565:	c9                   	leave  
c0106566:	c3                   	ret    

c0106567 <__kmalloc>:

static void *__kmalloc(size_t size, gfp_t gfp)
{
c0106567:	f3 0f 1e fb          	endbr32 
c010656b:	55                   	push   %ebp
c010656c:	89 e5                	mov    %esp,%ebp
c010656e:	83 ec 28             	sub    $0x28,%esp
	slob_t *m;
	bigblock_t *bb;
	unsigned long flags;

	if (size < PAGE_SIZE - SLOB_UNIT) {
c0106571:	81 7d 08 f7 0f 00 00 	cmpl   $0xff7,0x8(%ebp)
c0106578:	77 3b                	ja     c01065b5 <__kmalloc+0x4e>
		m = slob_alloc(size + SLOB_UNIT, gfp, 0);
c010657a:	8b 45 08             	mov    0x8(%ebp),%eax
c010657d:	8d 50 08             	lea    0x8(%eax),%edx
c0106580:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106587:	00 
c0106588:	8b 45 0c             	mov    0xc(%ebp),%eax
c010658b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010658f:	89 14 24             	mov    %edx,(%esp)
c0106592:	e8 63 fc ff ff       	call   c01061fa <slob_alloc>
c0106597:	89 45 ec             	mov    %eax,-0x14(%ebp)
		return m ? (void *)(m + 1) : 0;
c010659a:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010659e:	74 0b                	je     c01065ab <__kmalloc+0x44>
c01065a0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01065a3:	83 c0 08             	add    $0x8,%eax
c01065a6:	e9 b0 00 00 00       	jmp    c010665b <__kmalloc+0xf4>
c01065ab:	b8 00 00 00 00       	mov    $0x0,%eax
c01065b0:	e9 a6 00 00 00       	jmp    c010665b <__kmalloc+0xf4>
	}

	bb = slob_alloc(sizeof(bigblock_t), gfp, 0);
c01065b5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01065bc:	00 
c01065bd:	8b 45 0c             	mov    0xc(%ebp),%eax
c01065c0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01065c4:	c7 04 24 0c 00 00 00 	movl   $0xc,(%esp)
c01065cb:	e8 2a fc ff ff       	call   c01061fa <slob_alloc>
c01065d0:	89 45 f4             	mov    %eax,-0xc(%ebp)
	if (!bb)
c01065d3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01065d7:	75 07                	jne    c01065e0 <__kmalloc+0x79>
		return 0;
c01065d9:	b8 00 00 00 00       	mov    $0x0,%eax
c01065de:	eb 7b                	jmp    c010665b <__kmalloc+0xf4>

	bb->order = find_order(size);
c01065e0:	8b 45 08             	mov    0x8(%ebp),%eax
c01065e3:	89 04 24             	mov    %eax,(%esp)
c01065e6:	e8 55 ff ff ff       	call   c0106540 <find_order>
c01065eb:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01065ee:	89 02                	mov    %eax,(%edx)
	bb->pages = (void *)__slob_get_free_pages(gfp, bb->order);
c01065f0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01065f3:	8b 00                	mov    (%eax),%eax
c01065f5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01065f9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01065fc:	89 04 24             	mov    %eax,(%esp)
c01065ff:	e8 84 fb ff ff       	call   c0106188 <__slob_get_free_pages>
c0106604:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0106607:	89 42 04             	mov    %eax,0x4(%edx)

	if (bb->pages) {
c010660a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010660d:	8b 40 04             	mov    0x4(%eax),%eax
c0106610:	85 c0                	test   %eax,%eax
c0106612:	74 2f                	je     c0106643 <__kmalloc+0xdc>
		spin_lock_irqsave(&block_lock, flags);
c0106614:	e8 24 fa ff ff       	call   c010603d <__intr_save>
c0106619:	89 45 f0             	mov    %eax,-0x10(%ebp)
		bb->next = bigblocks;
c010661c:	8b 15 10 c0 12 c0    	mov    0xc012c010,%edx
c0106622:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106625:	89 50 08             	mov    %edx,0x8(%eax)
		bigblocks = bb;
c0106628:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010662b:	a3 10 c0 12 c0       	mov    %eax,0xc012c010
		spin_unlock_irqrestore(&block_lock, flags);
c0106630:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106633:	89 04 24             	mov    %eax,(%esp)
c0106636:	e8 2c fa ff ff       	call   c0106067 <__intr_restore>
		return bb->pages;
c010663b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010663e:	8b 40 04             	mov    0x4(%eax),%eax
c0106641:	eb 18                	jmp    c010665b <__kmalloc+0xf4>
	}

	slob_free(bb, sizeof(bigblock_t));
c0106643:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
c010664a:	00 
c010664b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010664e:	89 04 24             	mov    %eax,(%esp)
c0106651:	e8 79 fd ff ff       	call   c01063cf <slob_free>
	return 0;
c0106656:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010665b:	c9                   	leave  
c010665c:	c3                   	ret    

c010665d <kmalloc>:

void *
kmalloc(size_t size)
{
c010665d:	f3 0f 1e fb          	endbr32 
c0106661:	55                   	push   %ebp
c0106662:	89 e5                	mov    %esp,%ebp
c0106664:	83 ec 18             	sub    $0x18,%esp
  return __kmalloc(size, 0);
c0106667:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010666e:	00 
c010666f:	8b 45 08             	mov    0x8(%ebp),%eax
c0106672:	89 04 24             	mov    %eax,(%esp)
c0106675:	e8 ed fe ff ff       	call   c0106567 <__kmalloc>
}
c010667a:	c9                   	leave  
c010667b:	c3                   	ret    

c010667c <kfree>:


void kfree(void *block)
{
c010667c:	f3 0f 1e fb          	endbr32 
c0106680:	55                   	push   %ebp
c0106681:	89 e5                	mov    %esp,%ebp
c0106683:	83 ec 28             	sub    $0x28,%esp
	bigblock_t *bb, **last = &bigblocks;
c0106686:	c7 45 f0 10 c0 12 c0 	movl   $0xc012c010,-0x10(%ebp)
	unsigned long flags;

	if (!block)
c010668d:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0106691:	0f 84 a3 00 00 00    	je     c010673a <kfree+0xbe>
		return;

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
c0106697:	8b 45 08             	mov    0x8(%ebp),%eax
c010669a:	25 ff 0f 00 00       	and    $0xfff,%eax
c010669f:	85 c0                	test   %eax,%eax
c01066a1:	75 7f                	jne    c0106722 <kfree+0xa6>
		/* might be on the big block list */
		spin_lock_irqsave(&block_lock, flags);
c01066a3:	e8 95 f9 ff ff       	call   c010603d <__intr_save>
c01066a8:	89 45 ec             	mov    %eax,-0x14(%ebp)
		for (bb = bigblocks; bb; last = &bb->next, bb = bb->next) {
c01066ab:	a1 10 c0 12 c0       	mov    0xc012c010,%eax
c01066b0:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01066b3:	eb 5c                	jmp    c0106711 <kfree+0x95>
			if (bb->pages == block) {
c01066b5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01066b8:	8b 40 04             	mov    0x4(%eax),%eax
c01066bb:	39 45 08             	cmp    %eax,0x8(%ebp)
c01066be:	75 3f                	jne    c01066ff <kfree+0x83>
				*last = bb->next;
c01066c0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01066c3:	8b 50 08             	mov    0x8(%eax),%edx
c01066c6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01066c9:	89 10                	mov    %edx,(%eax)
				spin_unlock_irqrestore(&block_lock, flags);
c01066cb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01066ce:	89 04 24             	mov    %eax,(%esp)
c01066d1:	e8 91 f9 ff ff       	call   c0106067 <__intr_restore>
				__slob_free_pages((unsigned long)block, bb->order);
c01066d6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01066d9:	8b 10                	mov    (%eax),%edx
c01066db:	8b 45 08             	mov    0x8(%ebp),%eax
c01066de:	89 54 24 04          	mov    %edx,0x4(%esp)
c01066e2:	89 04 24             	mov    %eax,(%esp)
c01066e5:	e8 db fa ff ff       	call   c01061c5 <__slob_free_pages>
				slob_free(bb, sizeof(bigblock_t));
c01066ea:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
c01066f1:	00 
c01066f2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01066f5:	89 04 24             	mov    %eax,(%esp)
c01066f8:	e8 d2 fc ff ff       	call   c01063cf <slob_free>
				return;
c01066fd:	eb 3c                	jmp    c010673b <kfree+0xbf>
		for (bb = bigblocks; bb; last = &bb->next, bb = bb->next) {
c01066ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106702:	83 c0 08             	add    $0x8,%eax
c0106705:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106708:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010670b:	8b 40 08             	mov    0x8(%eax),%eax
c010670e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106711:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106715:	75 9e                	jne    c01066b5 <kfree+0x39>
			}
		}
		spin_unlock_irqrestore(&block_lock, flags);
c0106717:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010671a:	89 04 24             	mov    %eax,(%esp)
c010671d:	e8 45 f9 ff ff       	call   c0106067 <__intr_restore>
	}

	slob_free((slob_t *)block - 1, 0);
c0106722:	8b 45 08             	mov    0x8(%ebp),%eax
c0106725:	83 e8 08             	sub    $0x8,%eax
c0106728:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010672f:	00 
c0106730:	89 04 24             	mov    %eax,(%esp)
c0106733:	e8 97 fc ff ff       	call   c01063cf <slob_free>
	return;
c0106738:	eb 01                	jmp    c010673b <kfree+0xbf>
		return;
c010673a:	90                   	nop
}
c010673b:	c9                   	leave  
c010673c:	c3                   	ret    

c010673d <ksize>:


unsigned int ksize(const void *block)
{
c010673d:	f3 0f 1e fb          	endbr32 
c0106741:	55                   	push   %ebp
c0106742:	89 e5                	mov    %esp,%ebp
c0106744:	83 ec 28             	sub    $0x28,%esp
	bigblock_t *bb;
	unsigned long flags;

	if (!block)
c0106747:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010674b:	75 07                	jne    c0106754 <ksize+0x17>
		return 0;
c010674d:	b8 00 00 00 00       	mov    $0x0,%eax
c0106752:	eb 6b                	jmp    c01067bf <ksize+0x82>

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
c0106754:	8b 45 08             	mov    0x8(%ebp),%eax
c0106757:	25 ff 0f 00 00       	and    $0xfff,%eax
c010675c:	85 c0                	test   %eax,%eax
c010675e:	75 54                	jne    c01067b4 <ksize+0x77>
		spin_lock_irqsave(&block_lock, flags);
c0106760:	e8 d8 f8 ff ff       	call   c010603d <__intr_save>
c0106765:	89 45 f0             	mov    %eax,-0x10(%ebp)
		for (bb = bigblocks; bb; bb = bb->next)
c0106768:	a1 10 c0 12 c0       	mov    0xc012c010,%eax
c010676d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106770:	eb 31                	jmp    c01067a3 <ksize+0x66>
			if (bb->pages == block) {
c0106772:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106775:	8b 40 04             	mov    0x4(%eax),%eax
c0106778:	39 45 08             	cmp    %eax,0x8(%ebp)
c010677b:	75 1d                	jne    c010679a <ksize+0x5d>
				spin_unlock_irqrestore(&slob_lock, flags);
c010677d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106780:	89 04 24             	mov    %eax,(%esp)
c0106783:	e8 df f8 ff ff       	call   c0106067 <__intr_restore>
				return PAGE_SIZE << bb->order;
c0106788:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010678b:	8b 00                	mov    (%eax),%eax
c010678d:	ba 00 10 00 00       	mov    $0x1000,%edx
c0106792:	88 c1                	mov    %al,%cl
c0106794:	d3 e2                	shl    %cl,%edx
c0106796:	89 d0                	mov    %edx,%eax
c0106798:	eb 25                	jmp    c01067bf <ksize+0x82>
		for (bb = bigblocks; bb; bb = bb->next)
c010679a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010679d:	8b 40 08             	mov    0x8(%eax),%eax
c01067a0:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01067a3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01067a7:	75 c9                	jne    c0106772 <ksize+0x35>
			}
		spin_unlock_irqrestore(&block_lock, flags);
c01067a9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01067ac:	89 04 24             	mov    %eax,(%esp)
c01067af:	e8 b3 f8 ff ff       	call   c0106067 <__intr_restore>
	}

	return ((slob_t *)block - 1)->units * SLOB_UNIT;
c01067b4:	8b 45 08             	mov    0x8(%ebp),%eax
c01067b7:	83 e8 08             	sub    $0x8,%eax
c01067ba:	8b 00                	mov    (%eax),%eax
c01067bc:	c1 e0 03             	shl    $0x3,%eax
}
c01067bf:	c9                   	leave  
c01067c0:	c3                   	ret    

c01067c1 <pa2page>:
pa2page(uintptr_t pa) {
c01067c1:	55                   	push   %ebp
c01067c2:	89 e5                	mov    %esp,%ebp
c01067c4:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c01067c7:	8b 45 08             	mov    0x8(%ebp),%eax
c01067ca:	c1 e8 0c             	shr    $0xc,%eax
c01067cd:	89 c2                	mov    %eax,%edx
c01067cf:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c01067d4:	39 c2                	cmp    %eax,%edx
c01067d6:	72 1c                	jb     c01067f4 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c01067d8:	c7 44 24 08 18 b7 10 	movl   $0xc010b718,0x8(%esp)
c01067df:	c0 
c01067e0:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c01067e7:	00 
c01067e8:	c7 04 24 37 b7 10 c0 	movl   $0xc010b737,(%esp)
c01067ef:	e8 49 9c ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c01067f4:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c01067f9:	8b 55 08             	mov    0x8(%ebp),%edx
c01067fc:	c1 ea 0c             	shr    $0xc,%edx
c01067ff:	c1 e2 05             	shl    $0x5,%edx
c0106802:	01 d0                	add    %edx,%eax
}
c0106804:	c9                   	leave  
c0106805:	c3                   	ret    

c0106806 <pte2page>:
pte2page(pte_t pte) {
c0106806:	55                   	push   %ebp
c0106807:	89 e5                	mov    %esp,%ebp
c0106809:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c010680c:	8b 45 08             	mov    0x8(%ebp),%eax
c010680f:	83 e0 01             	and    $0x1,%eax
c0106812:	85 c0                	test   %eax,%eax
c0106814:	75 1c                	jne    c0106832 <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c0106816:	c7 44 24 08 48 b7 10 	movl   $0xc010b748,0x8(%esp)
c010681d:	c0 
c010681e:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c0106825:	00 
c0106826:	c7 04 24 37 b7 10 c0 	movl   $0xc010b737,(%esp)
c010682d:	e8 0b 9c ff ff       	call   c010043d <__panic>
    return pa2page(PTE_ADDR(pte));
c0106832:	8b 45 08             	mov    0x8(%ebp),%eax
c0106835:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010683a:	89 04 24             	mov    %eax,(%esp)
c010683d:	e8 7f ff ff ff       	call   c01067c1 <pa2page>
}
c0106842:	c9                   	leave  
c0106843:	c3                   	ret    

c0106844 <swap_init>:

static void check_swap(void);

int
swap_init(void)
{
c0106844:	f3 0f 1e fb          	endbr32 
c0106848:	55                   	push   %ebp
c0106849:	89 e5                	mov    %esp,%ebp
c010684b:	83 ec 28             	sub    $0x28,%esp
     swapfs_init();
c010684e:	e8 ed 1d 00 00       	call   c0108640 <swapfs_init>

     if (!(1024 <= max_swap_offset && max_swap_offset < MAX_SWAP_OFFSET_LIMIT))
c0106853:	a1 1c e1 12 c0       	mov    0xc012e11c,%eax
c0106858:	3d ff 03 00 00       	cmp    $0x3ff,%eax
c010685d:	76 0c                	jbe    c010686b <swap_init+0x27>
c010685f:	a1 1c e1 12 c0       	mov    0xc012e11c,%eax
c0106864:	3d ff ff ff 00       	cmp    $0xffffff,%eax
c0106869:	76 25                	jbe    c0106890 <swap_init+0x4c>
     {
          panic("bad max_swap_offset %08x.\n", max_swap_offset);
c010686b:	a1 1c e1 12 c0       	mov    0xc012e11c,%eax
c0106870:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106874:	c7 44 24 08 69 b7 10 	movl   $0xc010b769,0x8(%esp)
c010687b:	c0 
c010687c:	c7 44 24 04 25 00 00 	movl   $0x25,0x4(%esp)
c0106883:	00 
c0106884:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c010688b:	e8 ad 9b ff ff       	call   c010043d <__panic>
     }
     

     sm = &swap_manager_fifo;
c0106890:	c7 05 1c c0 12 c0 40 	movl   $0xc0128a40,0xc012c01c
c0106897:	8a 12 c0 
     int r = sm->init();
c010689a:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c010689f:	8b 40 04             	mov    0x4(%eax),%eax
c01068a2:	ff d0                	call   *%eax
c01068a4:	89 45 f4             	mov    %eax,-0xc(%ebp)
     
     if (r == 0)
c01068a7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01068ab:	75 26                	jne    c01068d3 <swap_init+0x8f>
     {
          swap_init_ok = 1;
c01068ad:	c7 05 14 c0 12 c0 01 	movl   $0x1,0xc012c014
c01068b4:	00 00 00 
          cprintf("SWAP: manager = %s\n", sm->name);
c01068b7:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c01068bc:	8b 00                	mov    (%eax),%eax
c01068be:	89 44 24 04          	mov    %eax,0x4(%esp)
c01068c2:	c7 04 24 93 b7 10 c0 	movl   $0xc010b793,(%esp)
c01068c9:	e8 03 9a ff ff       	call   c01002d1 <cprintf>
          check_swap();
c01068ce:	e8 b6 04 00 00       	call   c0106d89 <check_swap>
     }

     return r;
c01068d3:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01068d6:	c9                   	leave  
c01068d7:	c3                   	ret    

c01068d8 <swap_init_mm>:

int
swap_init_mm(struct mm_struct *mm)
{
c01068d8:	f3 0f 1e fb          	endbr32 
c01068dc:	55                   	push   %ebp
c01068dd:	89 e5                	mov    %esp,%ebp
c01068df:	83 ec 18             	sub    $0x18,%esp
     return sm->init_mm(mm);
c01068e2:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c01068e7:	8b 40 08             	mov    0x8(%eax),%eax
c01068ea:	8b 55 08             	mov    0x8(%ebp),%edx
c01068ed:	89 14 24             	mov    %edx,(%esp)
c01068f0:	ff d0                	call   *%eax
}
c01068f2:	c9                   	leave  
c01068f3:	c3                   	ret    

c01068f4 <swap_tick_event>:

int
swap_tick_event(struct mm_struct *mm)
{
c01068f4:	f3 0f 1e fb          	endbr32 
c01068f8:	55                   	push   %ebp
c01068f9:	89 e5                	mov    %esp,%ebp
c01068fb:	83 ec 18             	sub    $0x18,%esp
     return sm->tick_event(mm);
c01068fe:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c0106903:	8b 40 0c             	mov    0xc(%eax),%eax
c0106906:	8b 55 08             	mov    0x8(%ebp),%edx
c0106909:	89 14 24             	mov    %edx,(%esp)
c010690c:	ff d0                	call   *%eax
}
c010690e:	c9                   	leave  
c010690f:	c3                   	ret    

c0106910 <swap_map_swappable>:

int
swap_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c0106910:	f3 0f 1e fb          	endbr32 
c0106914:	55                   	push   %ebp
c0106915:	89 e5                	mov    %esp,%ebp
c0106917:	83 ec 18             	sub    $0x18,%esp
     return sm->map_swappable(mm, addr, page, swap_in);
c010691a:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c010691f:	8b 40 10             	mov    0x10(%eax),%eax
c0106922:	8b 55 14             	mov    0x14(%ebp),%edx
c0106925:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0106929:	8b 55 10             	mov    0x10(%ebp),%edx
c010692c:	89 54 24 08          	mov    %edx,0x8(%esp)
c0106930:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106933:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106937:	8b 55 08             	mov    0x8(%ebp),%edx
c010693a:	89 14 24             	mov    %edx,(%esp)
c010693d:	ff d0                	call   *%eax
}
c010693f:	c9                   	leave  
c0106940:	c3                   	ret    

c0106941 <swap_set_unswappable>:

int
swap_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c0106941:	f3 0f 1e fb          	endbr32 
c0106945:	55                   	push   %ebp
c0106946:	89 e5                	mov    %esp,%ebp
c0106948:	83 ec 18             	sub    $0x18,%esp
     return sm->set_unswappable(mm, addr);
c010694b:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c0106950:	8b 40 14             	mov    0x14(%eax),%eax
c0106953:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106956:	89 54 24 04          	mov    %edx,0x4(%esp)
c010695a:	8b 55 08             	mov    0x8(%ebp),%edx
c010695d:	89 14 24             	mov    %edx,(%esp)
c0106960:	ff d0                	call   *%eax
}
c0106962:	c9                   	leave  
c0106963:	c3                   	ret    

c0106964 <swap_out>:

volatile unsigned int swap_out_num=0;

int
swap_out(struct mm_struct *mm, int n, int in_tick)
{
c0106964:	f3 0f 1e fb          	endbr32 
c0106968:	55                   	push   %ebp
c0106969:	89 e5                	mov    %esp,%ebp
c010696b:	83 ec 38             	sub    $0x38,%esp
     int i;
     for (i = 0; i != n; ++ i)
c010696e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0106975:	e9 53 01 00 00       	jmp    c0106acd <swap_out+0x169>
     {
          uintptr_t v;
          //struct Page **ptr_page=NULL;
          struct Page *page;
          // cprintf("i %d, SWAP: call swap_out_victim\n",i);
          int r = sm->swap_out_victim(mm, &page, in_tick);
c010697a:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c010697f:	8b 40 18             	mov    0x18(%eax),%eax
c0106982:	8b 55 10             	mov    0x10(%ebp),%edx
c0106985:	89 54 24 08          	mov    %edx,0x8(%esp)
c0106989:	8d 55 e4             	lea    -0x1c(%ebp),%edx
c010698c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106990:	8b 55 08             	mov    0x8(%ebp),%edx
c0106993:	89 14 24             	mov    %edx,(%esp)
c0106996:	ff d0                	call   *%eax
c0106998:	89 45 f0             	mov    %eax,-0x10(%ebp)
          if (r != 0) {
c010699b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010699f:	74 18                	je     c01069b9 <swap_out+0x55>
                    cprintf("i %d, swap_out: call swap_out_victim failed\n",i);
c01069a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01069a4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01069a8:	c7 04 24 a8 b7 10 c0 	movl   $0xc010b7a8,(%esp)
c01069af:	e8 1d 99 ff ff       	call   c01002d1 <cprintf>
c01069b4:	e9 20 01 00 00       	jmp    c0106ad9 <swap_out+0x175>
          }          
          //assert(!PageReserved(page));

          //cprintf("SWAP: choose victim page 0x%08x\n", page);
          
          v=page->pra_vaddr; 
c01069b9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01069bc:	8b 40 1c             	mov    0x1c(%eax),%eax
c01069bf:	89 45 ec             	mov    %eax,-0x14(%ebp)
          pte_t *ptep = get_pte(mm->pgdir, v, 0);
c01069c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01069c5:	8b 40 0c             	mov    0xc(%eax),%eax
c01069c8:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01069cf:	00 
c01069d0:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01069d3:	89 54 24 04          	mov    %edx,0x4(%esp)
c01069d7:	89 04 24             	mov    %eax,(%esp)
c01069da:	e8 38 d3 ff ff       	call   c0103d17 <get_pte>
c01069df:	89 45 e8             	mov    %eax,-0x18(%ebp)
          assert((*ptep & PTE_P) != 0);
c01069e2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01069e5:	8b 00                	mov    (%eax),%eax
c01069e7:	83 e0 01             	and    $0x1,%eax
c01069ea:	85 c0                	test   %eax,%eax
c01069ec:	75 24                	jne    c0106a12 <swap_out+0xae>
c01069ee:	c7 44 24 0c d5 b7 10 	movl   $0xc010b7d5,0xc(%esp)
c01069f5:	c0 
c01069f6:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c01069fd:	c0 
c01069fe:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c0106a05:	00 
c0106a06:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106a0d:	e8 2b 9a ff ff       	call   c010043d <__panic>

          if (swapfs_write( (page->pra_vaddr/PGSIZE+1)<<8, page) != 0) {
c0106a12:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106a15:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106a18:	8b 52 1c             	mov    0x1c(%edx),%edx
c0106a1b:	c1 ea 0c             	shr    $0xc,%edx
c0106a1e:	42                   	inc    %edx
c0106a1f:	c1 e2 08             	shl    $0x8,%edx
c0106a22:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106a26:	89 14 24             	mov    %edx,(%esp)
c0106a29:	e8 d5 1c 00 00       	call   c0108703 <swapfs_write>
c0106a2e:	85 c0                	test   %eax,%eax
c0106a30:	74 34                	je     c0106a66 <swap_out+0x102>
                    cprintf("SWAP: failed to save\n");
c0106a32:	c7 04 24 ff b7 10 c0 	movl   $0xc010b7ff,(%esp)
c0106a39:	e8 93 98 ff ff       	call   c01002d1 <cprintf>
                    sm->map_swappable(mm, v, page, 0);
c0106a3e:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c0106a43:	8b 40 10             	mov    0x10(%eax),%eax
c0106a46:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106a49:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0106a50:	00 
c0106a51:	89 54 24 08          	mov    %edx,0x8(%esp)
c0106a55:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106a58:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106a5c:	8b 55 08             	mov    0x8(%ebp),%edx
c0106a5f:	89 14 24             	mov    %edx,(%esp)
c0106a62:	ff d0                	call   *%eax
c0106a64:	eb 64                	jmp    c0106aca <swap_out+0x166>
                    continue;
          }
          else {
                    cprintf("swap_out: i %d, store page in vaddr 0x%x to disk swap entry %d\n", i, v, page->pra_vaddr/PGSIZE+1);
c0106a66:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106a69:	8b 40 1c             	mov    0x1c(%eax),%eax
c0106a6c:	c1 e8 0c             	shr    $0xc,%eax
c0106a6f:	40                   	inc    %eax
c0106a70:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106a74:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a77:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106a7b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106a7e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106a82:	c7 04 24 18 b8 10 c0 	movl   $0xc010b818,(%esp)
c0106a89:	e8 43 98 ff ff       	call   c01002d1 <cprintf>
                    *ptep = (page->pra_vaddr/PGSIZE+1)<<8;
c0106a8e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106a91:	8b 40 1c             	mov    0x1c(%eax),%eax
c0106a94:	c1 e8 0c             	shr    $0xc,%eax
c0106a97:	40                   	inc    %eax
c0106a98:	c1 e0 08             	shl    $0x8,%eax
c0106a9b:	89 c2                	mov    %eax,%edx
c0106a9d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106aa0:	89 10                	mov    %edx,(%eax)
                    free_page(page);
c0106aa2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106aa5:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106aac:	00 
c0106aad:	89 04 24             	mov    %eax,(%esp)
c0106ab0:	e8 01 cc ff ff       	call   c01036b6 <free_pages>
          }
          
          tlb_invalidate(mm->pgdir, v);
c0106ab5:	8b 45 08             	mov    0x8(%ebp),%eax
c0106ab8:	8b 40 0c             	mov    0xc(%eax),%eax
c0106abb:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106abe:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106ac2:	89 04 24             	mov    %eax,(%esp)
c0106ac5:	e8 54 d5 ff ff       	call   c010401e <tlb_invalidate>
     for (i = 0; i != n; ++ i)
c0106aca:	ff 45 f4             	incl   -0xc(%ebp)
c0106acd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106ad0:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0106ad3:	0f 85 a1 fe ff ff    	jne    c010697a <swap_out+0x16>
     }
     return i;
c0106ad9:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0106adc:	c9                   	leave  
c0106add:	c3                   	ret    

c0106ade <swap_in>:

int
swap_in(struct mm_struct *mm, uintptr_t addr, struct Page **ptr_result)
{
c0106ade:	f3 0f 1e fb          	endbr32 
c0106ae2:	55                   	push   %ebp
c0106ae3:	89 e5                	mov    %esp,%ebp
c0106ae5:	83 ec 28             	sub    $0x28,%esp
     struct Page *result = alloc_page();
c0106ae8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106aef:	e8 53 cb ff ff       	call   c0103647 <alloc_pages>
c0106af4:	89 45 f4             	mov    %eax,-0xc(%ebp)
     assert(result!=NULL);
c0106af7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106afb:	75 24                	jne    c0106b21 <swap_in+0x43>
c0106afd:	c7 44 24 0c 58 b8 10 	movl   $0xc010b858,0xc(%esp)
c0106b04:	c0 
c0106b05:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106b0c:	c0 
c0106b0d:	c7 44 24 04 7b 00 00 	movl   $0x7b,0x4(%esp)
c0106b14:	00 
c0106b15:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106b1c:	e8 1c 99 ff ff       	call   c010043d <__panic>

     pte_t *ptep = get_pte(mm->pgdir, addr, 0);
c0106b21:	8b 45 08             	mov    0x8(%ebp),%eax
c0106b24:	8b 40 0c             	mov    0xc(%eax),%eax
c0106b27:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106b2e:	00 
c0106b2f:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106b32:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106b36:	89 04 24             	mov    %eax,(%esp)
c0106b39:	e8 d9 d1 ff ff       	call   c0103d17 <get_pte>
c0106b3e:	89 45 f0             	mov    %eax,-0x10(%ebp)
     // cprintf("SWAP: load ptep %x swap entry %d to vaddr 0x%08x, page %x, No %d\n", ptep, (*ptep)>>8, addr, result, (result-pages));
    
     int r;
     if ((r = swapfs_read((*ptep), result)) != 0)
c0106b41:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106b44:	8b 00                	mov    (%eax),%eax
c0106b46:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0106b49:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106b4d:	89 04 24             	mov    %eax,(%esp)
c0106b50:	e8 38 1b 00 00       	call   c010868d <swapfs_read>
c0106b55:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106b58:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106b5c:	74 2a                	je     c0106b88 <swap_in+0xaa>
     {
        assert(r!=0);
c0106b5e:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106b62:	75 24                	jne    c0106b88 <swap_in+0xaa>
c0106b64:	c7 44 24 0c 65 b8 10 	movl   $0xc010b865,0xc(%esp)
c0106b6b:	c0 
c0106b6c:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106b73:	c0 
c0106b74:	c7 44 24 04 83 00 00 	movl   $0x83,0x4(%esp)
c0106b7b:	00 
c0106b7c:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106b83:	e8 b5 98 ff ff       	call   c010043d <__panic>
     }
     cprintf("swap_in: load disk swap entry %d with swap_page in vadr 0x%x\n", (*ptep)>>8, addr);
c0106b88:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106b8b:	8b 00                	mov    (%eax),%eax
c0106b8d:	c1 e8 08             	shr    $0x8,%eax
c0106b90:	89 c2                	mov    %eax,%edx
c0106b92:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106b95:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106b99:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106b9d:	c7 04 24 6c b8 10 c0 	movl   $0xc010b86c,(%esp)
c0106ba4:	e8 28 97 ff ff       	call   c01002d1 <cprintf>
     *ptr_result=result;
c0106ba9:	8b 45 10             	mov    0x10(%ebp),%eax
c0106bac:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0106baf:	89 10                	mov    %edx,(%eax)
     return 0;
c0106bb1:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106bb6:	c9                   	leave  
c0106bb7:	c3                   	ret    

c0106bb8 <check_content_set>:



static inline void
check_content_set(void)
{
c0106bb8:	55                   	push   %ebp
c0106bb9:	89 e5                	mov    %esp,%ebp
c0106bbb:	83 ec 18             	sub    $0x18,%esp
     *(unsigned char *)0x1000 = 0x0a;
c0106bbe:	b8 00 10 00 00       	mov    $0x1000,%eax
c0106bc3:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c0106bc6:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0106bcb:	83 f8 01             	cmp    $0x1,%eax
c0106bce:	74 24                	je     c0106bf4 <check_content_set+0x3c>
c0106bd0:	c7 44 24 0c aa b8 10 	movl   $0xc010b8aa,0xc(%esp)
c0106bd7:	c0 
c0106bd8:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106bdf:	c0 
c0106be0:	c7 44 24 04 90 00 00 	movl   $0x90,0x4(%esp)
c0106be7:	00 
c0106be8:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106bef:	e8 49 98 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x1010 = 0x0a;
c0106bf4:	b8 10 10 00 00       	mov    $0x1010,%eax
c0106bf9:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c0106bfc:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0106c01:	83 f8 01             	cmp    $0x1,%eax
c0106c04:	74 24                	je     c0106c2a <check_content_set+0x72>
c0106c06:	c7 44 24 0c aa b8 10 	movl   $0xc010b8aa,0xc(%esp)
c0106c0d:	c0 
c0106c0e:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106c15:	c0 
c0106c16:	c7 44 24 04 92 00 00 	movl   $0x92,0x4(%esp)
c0106c1d:	00 
c0106c1e:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106c25:	e8 13 98 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x2000 = 0x0b;
c0106c2a:	b8 00 20 00 00       	mov    $0x2000,%eax
c0106c2f:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c0106c32:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0106c37:	83 f8 02             	cmp    $0x2,%eax
c0106c3a:	74 24                	je     c0106c60 <check_content_set+0xa8>
c0106c3c:	c7 44 24 0c b9 b8 10 	movl   $0xc010b8b9,0xc(%esp)
c0106c43:	c0 
c0106c44:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106c4b:	c0 
c0106c4c:	c7 44 24 04 94 00 00 	movl   $0x94,0x4(%esp)
c0106c53:	00 
c0106c54:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106c5b:	e8 dd 97 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x2010 = 0x0b;
c0106c60:	b8 10 20 00 00       	mov    $0x2010,%eax
c0106c65:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c0106c68:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0106c6d:	83 f8 02             	cmp    $0x2,%eax
c0106c70:	74 24                	je     c0106c96 <check_content_set+0xde>
c0106c72:	c7 44 24 0c b9 b8 10 	movl   $0xc010b8b9,0xc(%esp)
c0106c79:	c0 
c0106c7a:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106c81:	c0 
c0106c82:	c7 44 24 04 96 00 00 	movl   $0x96,0x4(%esp)
c0106c89:	00 
c0106c8a:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106c91:	e8 a7 97 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x3000 = 0x0c;
c0106c96:	b8 00 30 00 00       	mov    $0x3000,%eax
c0106c9b:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c0106c9e:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0106ca3:	83 f8 03             	cmp    $0x3,%eax
c0106ca6:	74 24                	je     c0106ccc <check_content_set+0x114>
c0106ca8:	c7 44 24 0c c8 b8 10 	movl   $0xc010b8c8,0xc(%esp)
c0106caf:	c0 
c0106cb0:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106cb7:	c0 
c0106cb8:	c7 44 24 04 98 00 00 	movl   $0x98,0x4(%esp)
c0106cbf:	00 
c0106cc0:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106cc7:	e8 71 97 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x3010 = 0x0c;
c0106ccc:	b8 10 30 00 00       	mov    $0x3010,%eax
c0106cd1:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c0106cd4:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0106cd9:	83 f8 03             	cmp    $0x3,%eax
c0106cdc:	74 24                	je     c0106d02 <check_content_set+0x14a>
c0106cde:	c7 44 24 0c c8 b8 10 	movl   $0xc010b8c8,0xc(%esp)
c0106ce5:	c0 
c0106ce6:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106ced:	c0 
c0106cee:	c7 44 24 04 9a 00 00 	movl   $0x9a,0x4(%esp)
c0106cf5:	00 
c0106cf6:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106cfd:	e8 3b 97 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x4000 = 0x0d;
c0106d02:	b8 00 40 00 00       	mov    $0x4000,%eax
c0106d07:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c0106d0a:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0106d0f:	83 f8 04             	cmp    $0x4,%eax
c0106d12:	74 24                	je     c0106d38 <check_content_set+0x180>
c0106d14:	c7 44 24 0c d7 b8 10 	movl   $0xc010b8d7,0xc(%esp)
c0106d1b:	c0 
c0106d1c:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106d23:	c0 
c0106d24:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
c0106d2b:	00 
c0106d2c:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106d33:	e8 05 97 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x4010 = 0x0d;
c0106d38:	b8 10 40 00 00       	mov    $0x4010,%eax
c0106d3d:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c0106d40:	a1 0c c0 12 c0       	mov    0xc012c00c,%eax
c0106d45:	83 f8 04             	cmp    $0x4,%eax
c0106d48:	74 24                	je     c0106d6e <check_content_set+0x1b6>
c0106d4a:	c7 44 24 0c d7 b8 10 	movl   $0xc010b8d7,0xc(%esp)
c0106d51:	c0 
c0106d52:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106d59:	c0 
c0106d5a:	c7 44 24 04 9e 00 00 	movl   $0x9e,0x4(%esp)
c0106d61:	00 
c0106d62:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106d69:	e8 cf 96 ff ff       	call   c010043d <__panic>
}
c0106d6e:	90                   	nop
c0106d6f:	c9                   	leave  
c0106d70:	c3                   	ret    

c0106d71 <check_content_access>:

static inline int
check_content_access(void)
{
c0106d71:	55                   	push   %ebp
c0106d72:	89 e5                	mov    %esp,%ebp
c0106d74:	83 ec 18             	sub    $0x18,%esp
    int ret = sm->check_swap();
c0106d77:	a1 1c c0 12 c0       	mov    0xc012c01c,%eax
c0106d7c:	8b 40 1c             	mov    0x1c(%eax),%eax
c0106d7f:	ff d0                	call   *%eax
c0106d81:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return ret;
c0106d84:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0106d87:	c9                   	leave  
c0106d88:	c3                   	ret    

c0106d89 <check_swap>:
#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
check_swap(void)
{
c0106d89:	f3 0f 1e fb          	endbr32 
c0106d8d:	55                   	push   %ebp
c0106d8e:	89 e5                	mov    %esp,%ebp
c0106d90:	83 ec 78             	sub    $0x78,%esp
    //backup mem env
     int ret, count = 0, total = 0, i;
c0106d93:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0106d9a:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
     list_entry_t *le = &free_list;
c0106da1:	c7 45 e8 44 e1 12 c0 	movl   $0xc012e144,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c0106da8:	eb 6a                	jmp    c0106e14 <check_swap+0x8b>
        struct Page *p = le2page(le, page_link);
c0106daa:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106dad:	83 e8 0c             	sub    $0xc,%eax
c0106db0:	89 45 c8             	mov    %eax,-0x38(%ebp)
        assert(PageProperty(p));
c0106db3:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0106db6:	83 c0 04             	add    $0x4,%eax
c0106db9:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
c0106dc0:	89 45 c0             	mov    %eax,-0x40(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0106dc3:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0106dc6:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0106dc9:	0f a3 10             	bt     %edx,(%eax)
c0106dcc:	19 c0                	sbb    %eax,%eax
c0106dce:	89 45 bc             	mov    %eax,-0x44(%ebp)
    return oldbit != 0;
c0106dd1:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0106dd5:	0f 95 c0             	setne  %al
c0106dd8:	0f b6 c0             	movzbl %al,%eax
c0106ddb:	85 c0                	test   %eax,%eax
c0106ddd:	75 24                	jne    c0106e03 <check_swap+0x7a>
c0106ddf:	c7 44 24 0c e6 b8 10 	movl   $0xc010b8e6,0xc(%esp)
c0106de6:	c0 
c0106de7:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106dee:	c0 
c0106def:	c7 44 24 04 b9 00 00 	movl   $0xb9,0x4(%esp)
c0106df6:	00 
c0106df7:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106dfe:	e8 3a 96 ff ff       	call   c010043d <__panic>
        count ++, total += p->property;
c0106e03:	ff 45 f4             	incl   -0xc(%ebp)
c0106e06:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0106e09:	8b 50 08             	mov    0x8(%eax),%edx
c0106e0c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106e0f:	01 d0                	add    %edx,%eax
c0106e11:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106e14:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106e17:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0106e1a:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0106e1d:	8b 40 04             	mov    0x4(%eax),%eax
     while ((le = list_next(le)) != &free_list) {
c0106e20:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0106e23:	81 7d e8 44 e1 12 c0 	cmpl   $0xc012e144,-0x18(%ebp)
c0106e2a:	0f 85 7a ff ff ff    	jne    c0106daa <check_swap+0x21>
     }
     assert(total == nr_free_pages());
c0106e30:	e8 b8 c8 ff ff       	call   c01036ed <nr_free_pages>
c0106e35:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0106e38:	39 d0                	cmp    %edx,%eax
c0106e3a:	74 24                	je     c0106e60 <check_swap+0xd7>
c0106e3c:	c7 44 24 0c f6 b8 10 	movl   $0xc010b8f6,0xc(%esp)
c0106e43:	c0 
c0106e44:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106e4b:	c0 
c0106e4c:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c0106e53:	00 
c0106e54:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106e5b:	e8 dd 95 ff ff       	call   c010043d <__panic>
     cprintf("BEGIN check_swap: count %d, total %d\n",count,total);
c0106e60:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106e63:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106e67:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106e6a:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106e6e:	c7 04 24 10 b9 10 c0 	movl   $0xc010b910,(%esp)
c0106e75:	e8 57 94 ff ff       	call   c01002d1 <cprintf>
     
     //now we set the phy pages env     
     struct mm_struct *mm = mm_create();
c0106e7a:	e8 eb e4 ff ff       	call   c010536a <mm_create>
c0106e7f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
     assert(mm != NULL);
c0106e82:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0106e86:	75 24                	jne    c0106eac <check_swap+0x123>
c0106e88:	c7 44 24 0c 36 b9 10 	movl   $0xc010b936,0xc(%esp)
c0106e8f:	c0 
c0106e90:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106e97:	c0 
c0106e98:	c7 44 24 04 c1 00 00 	movl   $0xc1,0x4(%esp)
c0106e9f:	00 
c0106ea0:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106ea7:	e8 91 95 ff ff       	call   c010043d <__panic>

     extern struct mm_struct *check_mm_struct;
     assert(check_mm_struct == NULL);
c0106eac:	a1 6c e0 12 c0       	mov    0xc012e06c,%eax
c0106eb1:	85 c0                	test   %eax,%eax
c0106eb3:	74 24                	je     c0106ed9 <check_swap+0x150>
c0106eb5:	c7 44 24 0c 41 b9 10 	movl   $0xc010b941,0xc(%esp)
c0106ebc:	c0 
c0106ebd:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106ec4:	c0 
c0106ec5:	c7 44 24 04 c4 00 00 	movl   $0xc4,0x4(%esp)
c0106ecc:	00 
c0106ecd:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106ed4:	e8 64 95 ff ff       	call   c010043d <__panic>

     check_mm_struct = mm;
c0106ed9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106edc:	a3 6c e0 12 c0       	mov    %eax,0xc012e06c

     pde_t *pgdir = mm->pgdir = boot_pgdir;
c0106ee1:	8b 15 e0 89 12 c0    	mov    0xc01289e0,%edx
c0106ee7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106eea:	89 50 0c             	mov    %edx,0xc(%eax)
c0106eed:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106ef0:	8b 40 0c             	mov    0xc(%eax),%eax
c0106ef3:	89 45 e0             	mov    %eax,-0x20(%ebp)
     assert(pgdir[0] == 0);
c0106ef6:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106ef9:	8b 00                	mov    (%eax),%eax
c0106efb:	85 c0                	test   %eax,%eax
c0106efd:	74 24                	je     c0106f23 <check_swap+0x19a>
c0106eff:	c7 44 24 0c 59 b9 10 	movl   $0xc010b959,0xc(%esp)
c0106f06:	c0 
c0106f07:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106f0e:	c0 
c0106f0f:	c7 44 24 04 c9 00 00 	movl   $0xc9,0x4(%esp)
c0106f16:	00 
c0106f17:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106f1e:	e8 1a 95 ff ff       	call   c010043d <__panic>

     struct vma_struct *vma = vma_create(BEING_CHECK_VALID_VADDR, CHECK_VALID_VADDR, VM_WRITE | VM_READ);
c0106f23:	c7 44 24 08 03 00 00 	movl   $0x3,0x8(%esp)
c0106f2a:	00 
c0106f2b:	c7 44 24 04 00 60 00 	movl   $0x6000,0x4(%esp)
c0106f32:	00 
c0106f33:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
c0106f3a:	e8 a8 e4 ff ff       	call   c01053e7 <vma_create>
c0106f3f:	89 45 dc             	mov    %eax,-0x24(%ebp)
     assert(vma != NULL);
c0106f42:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0106f46:	75 24                	jne    c0106f6c <check_swap+0x1e3>
c0106f48:	c7 44 24 0c 67 b9 10 	movl   $0xc010b967,0xc(%esp)
c0106f4f:	c0 
c0106f50:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106f57:	c0 
c0106f58:	c7 44 24 04 cc 00 00 	movl   $0xcc,0x4(%esp)
c0106f5f:	00 
c0106f60:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106f67:	e8 d1 94 ff ff       	call   c010043d <__panic>

     insert_vma_struct(mm, vma);
c0106f6c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106f6f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106f73:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106f76:	89 04 24             	mov    %eax,(%esp)
c0106f79:	e8 02 e6 ff ff       	call   c0105580 <insert_vma_struct>

     //setup the temp Page Table vaddr 0~4MB
     cprintf("setup Page Table for vaddr 0X1000, so alloc a page\n");
c0106f7e:	c7 04 24 74 b9 10 c0 	movl   $0xc010b974,(%esp)
c0106f85:	e8 47 93 ff ff       	call   c01002d1 <cprintf>
     pte_t *temp_ptep=NULL;
c0106f8a:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)
     temp_ptep = get_pte(mm->pgdir, BEING_CHECK_VALID_VADDR, 1);
c0106f91:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106f94:	8b 40 0c             	mov    0xc(%eax),%eax
c0106f97:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0106f9e:	00 
c0106f9f:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0106fa6:	00 
c0106fa7:	89 04 24             	mov    %eax,(%esp)
c0106faa:	e8 68 cd ff ff       	call   c0103d17 <get_pte>
c0106faf:	89 45 d8             	mov    %eax,-0x28(%ebp)
     assert(temp_ptep!= NULL);
c0106fb2:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c0106fb6:	75 24                	jne    c0106fdc <check_swap+0x253>
c0106fb8:	c7 44 24 0c a8 b9 10 	movl   $0xc010b9a8,0xc(%esp)
c0106fbf:	c0 
c0106fc0:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0106fc7:	c0 
c0106fc8:	c7 44 24 04 d4 00 00 	movl   $0xd4,0x4(%esp)
c0106fcf:	00 
c0106fd0:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0106fd7:	e8 61 94 ff ff       	call   c010043d <__panic>
     cprintf("setup Page Table vaddr 0~4MB OVER!\n");
c0106fdc:	c7 04 24 bc b9 10 c0 	movl   $0xc010b9bc,(%esp)
c0106fe3:	e8 e9 92 ff ff       	call   c01002d1 <cprintf>
     
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106fe8:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0106fef:	e9 a2 00 00 00       	jmp    c0107096 <check_swap+0x30d>
          check_rp[i] = alloc_page();
c0106ff4:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106ffb:	e8 47 c6 ff ff       	call   c0103647 <alloc_pages>
c0107000:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107003:	89 04 95 80 e0 12 c0 	mov    %eax,-0x3fed1f80(,%edx,4)
          assert(check_rp[i] != NULL );
c010700a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010700d:	8b 04 85 80 e0 12 c0 	mov    -0x3fed1f80(,%eax,4),%eax
c0107014:	85 c0                	test   %eax,%eax
c0107016:	75 24                	jne    c010703c <check_swap+0x2b3>
c0107018:	c7 44 24 0c e0 b9 10 	movl   $0xc010b9e0,0xc(%esp)
c010701f:	c0 
c0107020:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0107027:	c0 
c0107028:	c7 44 24 04 d9 00 00 	movl   $0xd9,0x4(%esp)
c010702f:	00 
c0107030:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0107037:	e8 01 94 ff ff       	call   c010043d <__panic>
          assert(!PageProperty(check_rp[i]));
c010703c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010703f:	8b 04 85 80 e0 12 c0 	mov    -0x3fed1f80(,%eax,4),%eax
c0107046:	83 c0 04             	add    $0x4,%eax
c0107049:	c7 45 b4 01 00 00 00 	movl   $0x1,-0x4c(%ebp)
c0107050:	89 45 b0             	mov    %eax,-0x50(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0107053:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0107056:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0107059:	0f a3 10             	bt     %edx,(%eax)
c010705c:	19 c0                	sbb    %eax,%eax
c010705e:	89 45 ac             	mov    %eax,-0x54(%ebp)
    return oldbit != 0;
c0107061:	83 7d ac 00          	cmpl   $0x0,-0x54(%ebp)
c0107065:	0f 95 c0             	setne  %al
c0107068:	0f b6 c0             	movzbl %al,%eax
c010706b:	85 c0                	test   %eax,%eax
c010706d:	74 24                	je     c0107093 <check_swap+0x30a>
c010706f:	c7 44 24 0c f4 b9 10 	movl   $0xc010b9f4,0xc(%esp)
c0107076:	c0 
c0107077:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c010707e:	c0 
c010707f:	c7 44 24 04 da 00 00 	movl   $0xda,0x4(%esp)
c0107086:	00 
c0107087:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c010708e:	e8 aa 93 ff ff       	call   c010043d <__panic>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107093:	ff 45 ec             	incl   -0x14(%ebp)
c0107096:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c010709a:	0f 8e 54 ff ff ff    	jle    c0106ff4 <check_swap+0x26b>
     }
     list_entry_t free_list_store = free_list;
c01070a0:	a1 44 e1 12 c0       	mov    0xc012e144,%eax
c01070a5:	8b 15 48 e1 12 c0    	mov    0xc012e148,%edx
c01070ab:	89 45 98             	mov    %eax,-0x68(%ebp)
c01070ae:	89 55 9c             	mov    %edx,-0x64(%ebp)
c01070b1:	c7 45 a4 44 e1 12 c0 	movl   $0xc012e144,-0x5c(%ebp)
    elm->prev = elm->next = elm;
c01070b8:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c01070bb:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c01070be:	89 50 04             	mov    %edx,0x4(%eax)
c01070c1:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c01070c4:	8b 50 04             	mov    0x4(%eax),%edx
c01070c7:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c01070ca:	89 10                	mov    %edx,(%eax)
}
c01070cc:	90                   	nop
c01070cd:	c7 45 a8 44 e1 12 c0 	movl   $0xc012e144,-0x58(%ebp)
    return list->next == list;
c01070d4:	8b 45 a8             	mov    -0x58(%ebp),%eax
c01070d7:	8b 40 04             	mov    0x4(%eax),%eax
c01070da:	39 45 a8             	cmp    %eax,-0x58(%ebp)
c01070dd:	0f 94 c0             	sete   %al
c01070e0:	0f b6 c0             	movzbl %al,%eax
     list_init(&free_list);
     assert(list_empty(&free_list));
c01070e3:	85 c0                	test   %eax,%eax
c01070e5:	75 24                	jne    c010710b <check_swap+0x382>
c01070e7:	c7 44 24 0c 0f ba 10 	movl   $0xc010ba0f,0xc(%esp)
c01070ee:	c0 
c01070ef:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c01070f6:	c0 
c01070f7:	c7 44 24 04 de 00 00 	movl   $0xde,0x4(%esp)
c01070fe:	00 
c01070ff:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0107106:	e8 32 93 ff ff       	call   c010043d <__panic>
     
     //assert(alloc_page() == NULL);
     
     unsigned int nr_free_store = nr_free;
c010710b:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c0107110:	89 45 d4             	mov    %eax,-0x2c(%ebp)
     nr_free = 0;
c0107113:	c7 05 4c e1 12 c0 00 	movl   $0x0,0xc012e14c
c010711a:	00 00 00 
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c010711d:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0107124:	eb 1d                	jmp    c0107143 <check_swap+0x3ba>
        free_pages(check_rp[i],1);
c0107126:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107129:	8b 04 85 80 e0 12 c0 	mov    -0x3fed1f80(,%eax,4),%eax
c0107130:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107137:	00 
c0107138:	89 04 24             	mov    %eax,(%esp)
c010713b:	e8 76 c5 ff ff       	call   c01036b6 <free_pages>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107140:	ff 45 ec             	incl   -0x14(%ebp)
c0107143:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0107147:	7e dd                	jle    c0107126 <check_swap+0x39d>
     }
     assert(nr_free==CHECK_VALID_PHY_PAGE_NUM);
c0107149:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c010714e:	83 f8 04             	cmp    $0x4,%eax
c0107151:	74 24                	je     c0107177 <check_swap+0x3ee>
c0107153:	c7 44 24 0c 28 ba 10 	movl   $0xc010ba28,0xc(%esp)
c010715a:	c0 
c010715b:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0107162:	c0 
c0107163:	c7 44 24 04 e7 00 00 	movl   $0xe7,0x4(%esp)
c010716a:	00 
c010716b:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0107172:	e8 c6 92 ff ff       	call   c010043d <__panic>
     
     cprintf("set up init env for check_swap begin!\n");
c0107177:	c7 04 24 4c ba 10 c0 	movl   $0xc010ba4c,(%esp)
c010717e:	e8 4e 91 ff ff       	call   c01002d1 <cprintf>
     //setup initial vir_page<->phy_page environment for page relpacement algorithm 

     
     pgfault_num=0;
c0107183:	c7 05 0c c0 12 c0 00 	movl   $0x0,0xc012c00c
c010718a:	00 00 00 
     
     check_content_set();
c010718d:	e8 26 fa ff ff       	call   c0106bb8 <check_content_set>
     assert( nr_free == 0);         
c0107192:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c0107197:	85 c0                	test   %eax,%eax
c0107199:	74 24                	je     c01071bf <check_swap+0x436>
c010719b:	c7 44 24 0c 73 ba 10 	movl   $0xc010ba73,0xc(%esp)
c01071a2:	c0 
c01071a3:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c01071aa:	c0 
c01071ab:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
c01071b2:	00 
c01071b3:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c01071ba:	e8 7e 92 ff ff       	call   c010043d <__panic>
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c01071bf:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01071c6:	eb 25                	jmp    c01071ed <check_swap+0x464>
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
c01071c8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01071cb:	c7 04 85 a0 e0 12 c0 	movl   $0xffffffff,-0x3fed1f60(,%eax,4)
c01071d2:	ff ff ff ff 
c01071d6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01071d9:	8b 14 85 a0 e0 12 c0 	mov    -0x3fed1f60(,%eax,4),%edx
c01071e0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01071e3:	89 14 85 e0 e0 12 c0 	mov    %edx,-0x3fed1f20(,%eax,4)
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c01071ea:	ff 45 ec             	incl   -0x14(%ebp)
c01071ed:	83 7d ec 09          	cmpl   $0x9,-0x14(%ebp)
c01071f1:	7e d5                	jle    c01071c8 <check_swap+0x43f>
     
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c01071f3:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01071fa:	e9 e8 00 00 00       	jmp    c01072e7 <check_swap+0x55e>
         check_ptep[i]=0;
c01071ff:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107202:	c7 04 85 34 e1 12 c0 	movl   $0x0,-0x3fed1ecc(,%eax,4)
c0107209:	00 00 00 00 
         check_ptep[i] = get_pte(pgdir, (i+1)*0x1000, 0);
c010720d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107210:	40                   	inc    %eax
c0107211:	c1 e0 0c             	shl    $0xc,%eax
c0107214:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010721b:	00 
c010721c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107220:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107223:	89 04 24             	mov    %eax,(%esp)
c0107226:	e8 ec ca ff ff       	call   c0103d17 <get_pte>
c010722b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010722e:	89 04 95 34 e1 12 c0 	mov    %eax,-0x3fed1ecc(,%edx,4)
         //cprintf("i %d, check_ptep addr %x, value %x\n", i, check_ptep[i], *check_ptep[i]);
         assert(check_ptep[i] != NULL);
c0107235:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107238:	8b 04 85 34 e1 12 c0 	mov    -0x3fed1ecc(,%eax,4),%eax
c010723f:	85 c0                	test   %eax,%eax
c0107241:	75 24                	jne    c0107267 <check_swap+0x4de>
c0107243:	c7 44 24 0c 80 ba 10 	movl   $0xc010ba80,0xc(%esp)
c010724a:	c0 
c010724b:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0107252:	c0 
c0107253:	c7 44 24 04 f8 00 00 	movl   $0xf8,0x4(%esp)
c010725a:	00 
c010725b:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c0107262:	e8 d6 91 ff ff       	call   c010043d <__panic>
         assert(pte2page(*check_ptep[i]) == check_rp[i]);
c0107267:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010726a:	8b 04 85 34 e1 12 c0 	mov    -0x3fed1ecc(,%eax,4),%eax
c0107271:	8b 00                	mov    (%eax),%eax
c0107273:	89 04 24             	mov    %eax,(%esp)
c0107276:	e8 8b f5 ff ff       	call   c0106806 <pte2page>
c010727b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010727e:	8b 14 95 80 e0 12 c0 	mov    -0x3fed1f80(,%edx,4),%edx
c0107285:	39 d0                	cmp    %edx,%eax
c0107287:	74 24                	je     c01072ad <check_swap+0x524>
c0107289:	c7 44 24 0c 98 ba 10 	movl   $0xc010ba98,0xc(%esp)
c0107290:	c0 
c0107291:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c0107298:	c0 
c0107299:	c7 44 24 04 f9 00 00 	movl   $0xf9,0x4(%esp)
c01072a0:	00 
c01072a1:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c01072a8:	e8 90 91 ff ff       	call   c010043d <__panic>
         assert((*check_ptep[i] & PTE_P));          
c01072ad:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01072b0:	8b 04 85 34 e1 12 c0 	mov    -0x3fed1ecc(,%eax,4),%eax
c01072b7:	8b 00                	mov    (%eax),%eax
c01072b9:	83 e0 01             	and    $0x1,%eax
c01072bc:	85 c0                	test   %eax,%eax
c01072be:	75 24                	jne    c01072e4 <check_swap+0x55b>
c01072c0:	c7 44 24 0c c0 ba 10 	movl   $0xc010bac0,0xc(%esp)
c01072c7:	c0 
c01072c8:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c01072cf:	c0 
c01072d0:	c7 44 24 04 fa 00 00 	movl   $0xfa,0x4(%esp)
c01072d7:	00 
c01072d8:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c01072df:	e8 59 91 ff ff       	call   c010043d <__panic>
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c01072e4:	ff 45 ec             	incl   -0x14(%ebp)
c01072e7:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c01072eb:	0f 8e 0e ff ff ff    	jle    c01071ff <check_swap+0x476>
     }
     cprintf("set up init env for check_swap over!\n");
c01072f1:	c7 04 24 dc ba 10 c0 	movl   $0xc010badc,(%esp)
c01072f8:	e8 d4 8f ff ff       	call   c01002d1 <cprintf>
     // now access the virt pages to test  page relpacement algorithm 
     ret=check_content_access();
c01072fd:	e8 6f fa ff ff       	call   c0106d71 <check_content_access>
c0107302:	89 45 d0             	mov    %eax,-0x30(%ebp)
     assert(ret==0);
c0107305:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c0107309:	74 24                	je     c010732f <check_swap+0x5a6>
c010730b:	c7 44 24 0c 02 bb 10 	movl   $0xc010bb02,0xc(%esp)
c0107312:	c0 
c0107313:	c7 44 24 08 ea b7 10 	movl   $0xc010b7ea,0x8(%esp)
c010731a:	c0 
c010731b:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
c0107322:	00 
c0107323:	c7 04 24 84 b7 10 c0 	movl   $0xc010b784,(%esp)
c010732a:	e8 0e 91 ff ff       	call   c010043d <__panic>
     
     //restore kernel mem env
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c010732f:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0107336:	eb 1d                	jmp    c0107355 <check_swap+0x5cc>
         free_pages(check_rp[i],1);
c0107338:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010733b:	8b 04 85 80 e0 12 c0 	mov    -0x3fed1f80(,%eax,4),%eax
c0107342:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107349:	00 
c010734a:	89 04 24             	mov    %eax,(%esp)
c010734d:	e8 64 c3 ff ff       	call   c01036b6 <free_pages>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107352:	ff 45 ec             	incl   -0x14(%ebp)
c0107355:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0107359:	7e dd                	jle    c0107338 <check_swap+0x5af>
     } 

     //free_page(pte2page(*temp_ptep));
     
     mm_destroy(mm);
c010735b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010735e:	89 04 24             	mov    %eax,(%esp)
c0107361:	e8 52 e3 ff ff       	call   c01056b8 <mm_destroy>
         
     nr_free = nr_free_store;
c0107366:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0107369:	a3 4c e1 12 c0       	mov    %eax,0xc012e14c
     free_list = free_list_store;
c010736e:	8b 45 98             	mov    -0x68(%ebp),%eax
c0107371:	8b 55 9c             	mov    -0x64(%ebp),%edx
c0107374:	a3 44 e1 12 c0       	mov    %eax,0xc012e144
c0107379:	89 15 48 e1 12 c0    	mov    %edx,0xc012e148

     
     le = &free_list;
c010737f:	c7 45 e8 44 e1 12 c0 	movl   $0xc012e144,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c0107386:	eb 1c                	jmp    c01073a4 <check_swap+0x61b>
         struct Page *p = le2page(le, page_link);
c0107388:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010738b:	83 e8 0c             	sub    $0xc,%eax
c010738e:	89 45 cc             	mov    %eax,-0x34(%ebp)
         count --, total -= p->property;
c0107391:	ff 4d f4             	decl   -0xc(%ebp)
c0107394:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107397:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010739a:	8b 40 08             	mov    0x8(%eax),%eax
c010739d:	29 c2                	sub    %eax,%edx
c010739f:	89 d0                	mov    %edx,%eax
c01073a1:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01073a4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01073a7:	89 45 a0             	mov    %eax,-0x60(%ebp)
    return listelm->next;
c01073aa:	8b 45 a0             	mov    -0x60(%ebp),%eax
c01073ad:	8b 40 04             	mov    0x4(%eax),%eax
     while ((le = list_next(le)) != &free_list) {
c01073b0:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01073b3:	81 7d e8 44 e1 12 c0 	cmpl   $0xc012e144,-0x18(%ebp)
c01073ba:	75 cc                	jne    c0107388 <check_swap+0x5ff>
     }
     cprintf("count is %d, total is %d\n",count,total);
c01073bc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01073bf:	89 44 24 08          	mov    %eax,0x8(%esp)
c01073c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01073c6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01073ca:	c7 04 24 09 bb 10 c0 	movl   $0xc010bb09,(%esp)
c01073d1:	e8 fb 8e ff ff       	call   c01002d1 <cprintf>
     //assert(count == 0);
     
     cprintf("check_swap() succeeded!\n");
c01073d6:	c7 04 24 23 bb 10 c0 	movl   $0xc010bb23,(%esp)
c01073dd:	e8 ef 8e ff ff       	call   c01002d1 <cprintf>
}
c01073e2:	90                   	nop
c01073e3:	c9                   	leave  
c01073e4:	c3                   	ret    

c01073e5 <page2ppn>:
page2ppn(struct Page *page) {
c01073e5:	55                   	push   %ebp
c01073e6:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01073e8:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c01073ed:	8b 55 08             	mov    0x8(%ebp),%edx
c01073f0:	29 c2                	sub    %eax,%edx
c01073f2:	89 d0                	mov    %edx,%eax
c01073f4:	c1 f8 05             	sar    $0x5,%eax
}
c01073f7:	5d                   	pop    %ebp
c01073f8:	c3                   	ret    

c01073f9 <page2pa>:
page2pa(struct Page *page) {
c01073f9:	55                   	push   %ebp
c01073fa:	89 e5                	mov    %esp,%ebp
c01073fc:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01073ff:	8b 45 08             	mov    0x8(%ebp),%eax
c0107402:	89 04 24             	mov    %eax,(%esp)
c0107405:	e8 db ff ff ff       	call   c01073e5 <page2ppn>
c010740a:	c1 e0 0c             	shl    $0xc,%eax
}
c010740d:	c9                   	leave  
c010740e:	c3                   	ret    

c010740f <page_ref>:
page_ref(struct Page *page) {
c010740f:	55                   	push   %ebp
c0107410:	89 e5                	mov    %esp,%ebp
    return page->ref;
c0107412:	8b 45 08             	mov    0x8(%ebp),%eax
c0107415:	8b 00                	mov    (%eax),%eax
}
c0107417:	5d                   	pop    %ebp
c0107418:	c3                   	ret    

c0107419 <set_page_ref>:
set_page_ref(struct Page *page, int val) {
c0107419:	55                   	push   %ebp
c010741a:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c010741c:	8b 45 08             	mov    0x8(%ebp),%eax
c010741f:	8b 55 0c             	mov    0xc(%ebp),%edx
c0107422:	89 10                	mov    %edx,(%eax)
}
c0107424:	90                   	nop
c0107425:	5d                   	pop    %ebp
c0107426:	c3                   	ret    

c0107427 <default_init>:

#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
default_init(void) {
c0107427:	f3 0f 1e fb          	endbr32 
c010742b:	55                   	push   %ebp
c010742c:	89 e5                	mov    %esp,%ebp
c010742e:	83 ec 10             	sub    $0x10,%esp
c0107431:	c7 45 fc 44 e1 12 c0 	movl   $0xc012e144,-0x4(%ebp)
    elm->prev = elm->next = elm;
c0107438:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010743b:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010743e:	89 50 04             	mov    %edx,0x4(%eax)
c0107441:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0107444:	8b 50 04             	mov    0x4(%eax),%edx
c0107447:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010744a:	89 10                	mov    %edx,(%eax)
}
c010744c:	90                   	nop
    list_init(&free_list);
    nr_free = 0;
c010744d:	c7 05 4c e1 12 c0 00 	movl   $0x0,0xc012e14c
c0107454:	00 00 00 
}
c0107457:	90                   	nop
c0107458:	c9                   	leave  
c0107459:	c3                   	ret    

c010745a <default_init_memmap>:

static void
default_init_memmap(struct Page *base, size_t n) {
c010745a:	f3 0f 1e fb          	endbr32 
c010745e:	55                   	push   %ebp
c010745f:	89 e5                	mov    %esp,%ebp
c0107461:	83 ec 58             	sub    $0x58,%esp
    assert(n > 0);
c0107464:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0107468:	75 24                	jne    c010748e <default_init_memmap+0x34>
c010746a:	c7 44 24 0c 3c bb 10 	movl   $0xc010bb3c,0xc(%esp)
c0107471:	c0 
c0107472:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107479:	c0 
c010747a:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c0107481:	00 
c0107482:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107489:	e8 af 8f ff ff       	call   c010043d <__panic>
    struct Page *p = base;
c010748e:	8b 45 08             	mov    0x8(%ebp),%eax
c0107491:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; p != base + n; p ++) {
c0107494:	eb 7d                	jmp    c0107513 <default_init_memmap+0xb9>
        assert(PageReserved(p));
c0107496:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107499:	83 c0 04             	add    $0x4,%eax
c010749c:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c01074a3:	89 45 ec             	mov    %eax,-0x14(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01074a6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01074a9:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01074ac:	0f a3 10             	bt     %edx,(%eax)
c01074af:	19 c0                	sbb    %eax,%eax
c01074b1:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return oldbit != 0;
c01074b4:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01074b8:	0f 95 c0             	setne  %al
c01074bb:	0f b6 c0             	movzbl %al,%eax
c01074be:	85 c0                	test   %eax,%eax
c01074c0:	75 24                	jne    c01074e6 <default_init_memmap+0x8c>
c01074c2:	c7 44 24 0c 6d bb 10 	movl   $0xc010bb6d,0xc(%esp)
c01074c9:	c0 
c01074ca:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01074d1:	c0 
c01074d2:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
c01074d9:	00 
c01074da:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01074e1:	e8 57 8f ff ff       	call   c010043d <__panic>
        p->flags = p->property = 0;
c01074e6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01074e9:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
c01074f0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01074f3:	8b 50 08             	mov    0x8(%eax),%edx
c01074f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01074f9:	89 50 04             	mov    %edx,0x4(%eax)
        set_page_ref(p, 0);
c01074fc:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0107503:	00 
c0107504:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107507:	89 04 24             	mov    %eax,(%esp)
c010750a:	e8 0a ff ff ff       	call   c0107419 <set_page_ref>
    for (; p != base + n; p ++) {
c010750f:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
c0107513:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107516:	c1 e0 05             	shl    $0x5,%eax
c0107519:	89 c2                	mov    %eax,%edx
c010751b:	8b 45 08             	mov    0x8(%ebp),%eax
c010751e:	01 d0                	add    %edx,%eax
c0107520:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0107523:	0f 85 6d ff ff ff    	jne    c0107496 <default_init_memmap+0x3c>
    }
    base->property = n;
c0107529:	8b 45 08             	mov    0x8(%ebp),%eax
c010752c:	8b 55 0c             	mov    0xc(%ebp),%edx
c010752f:	89 50 08             	mov    %edx,0x8(%eax)
    SetPageProperty(base);
c0107532:	8b 45 08             	mov    0x8(%ebp),%eax
c0107535:	83 c0 04             	add    $0x4,%eax
c0107538:	c7 45 c8 01 00 00 00 	movl   $0x1,-0x38(%ebp)
c010753f:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0107542:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0107545:	8b 55 c8             	mov    -0x38(%ebp),%edx
c0107548:	0f ab 10             	bts    %edx,(%eax)
}
c010754b:	90                   	nop
    nr_free += n;
c010754c:	8b 15 4c e1 12 c0    	mov    0xc012e14c,%edx
c0107552:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107555:	01 d0                	add    %edx,%eax
c0107557:	a3 4c e1 12 c0       	mov    %eax,0xc012e14c
    list_add(&free_list, &(base->page_link));
c010755c:	8b 45 08             	mov    0x8(%ebp),%eax
c010755f:	83 c0 0c             	add    $0xc,%eax
c0107562:	c7 45 e4 44 e1 12 c0 	movl   $0xc012e144,-0x1c(%ebp)
c0107569:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010756c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010756f:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0107572:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107575:	89 45 d8             	mov    %eax,-0x28(%ebp)
    __list_add(elm, listelm, listelm->next);
c0107578:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010757b:	8b 40 04             	mov    0x4(%eax),%eax
c010757e:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0107581:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0107584:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0107587:	89 55 d0             	mov    %edx,-0x30(%ebp)
c010758a:	89 45 cc             	mov    %eax,-0x34(%ebp)
    prev->next = next->prev = elm;
c010758d:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0107590:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0107593:	89 10                	mov    %edx,(%eax)
c0107595:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0107598:	8b 10                	mov    (%eax),%edx
c010759a:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010759d:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01075a0:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01075a3:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01075a6:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01075a9:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01075ac:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01075af:	89 10                	mov    %edx,(%eax)
}
c01075b1:	90                   	nop
}
c01075b2:	90                   	nop
}
c01075b3:	90                   	nop
}
c01075b4:	90                   	nop
c01075b5:	c9                   	leave  
c01075b6:	c3                   	ret    

c01075b7 <default_alloc_pages>:

static struct Page *
default_alloc_pages(size_t n) {
c01075b7:	f3 0f 1e fb          	endbr32 
c01075bb:	55                   	push   %ebp
c01075bc:	89 e5                	mov    %esp,%ebp
c01075be:	83 ec 68             	sub    $0x68,%esp
    assert(n > 0);
c01075c1:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01075c5:	75 24                	jne    c01075eb <default_alloc_pages+0x34>
c01075c7:	c7 44 24 0c 3c bb 10 	movl   $0xc010bb3c,0xc(%esp)
c01075ce:	c0 
c01075cf:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01075d6:	c0 
c01075d7:	c7 44 24 04 7c 00 00 	movl   $0x7c,0x4(%esp)
c01075de:	00 
c01075df:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01075e6:	e8 52 8e ff ff       	call   c010043d <__panic>
    if (n > nr_free) {
c01075eb:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c01075f0:	39 45 08             	cmp    %eax,0x8(%ebp)
c01075f3:	76 0a                	jbe    c01075ff <default_alloc_pages+0x48>
        return NULL;
c01075f5:	b8 00 00 00 00       	mov    $0x0,%eax
c01075fa:	e9 49 01 00 00       	jmp    c0107748 <default_alloc_pages+0x191>
    }
    struct Page *page = NULL;
c01075ff:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    list_entry_t *le = &free_list;
c0107606:	c7 45 f0 44 e1 12 c0 	movl   $0xc012e144,-0x10(%ebp)
    while ((le = list_next(le)) != &free_list) {
c010760d:	eb 1c                	jmp    c010762b <default_alloc_pages+0x74>
        struct Page *p = le2page(le, page_link);
c010760f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107612:	83 e8 0c             	sub    $0xc,%eax
c0107615:	89 45 ec             	mov    %eax,-0x14(%ebp)
        if (p->property >= n) {
c0107618:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010761b:	8b 40 08             	mov    0x8(%eax),%eax
c010761e:	39 45 08             	cmp    %eax,0x8(%ebp)
c0107621:	77 08                	ja     c010762b <default_alloc_pages+0x74>
            page = p;
c0107623:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107626:	89 45 f4             	mov    %eax,-0xc(%ebp)
            break;
c0107629:	eb 18                	jmp    c0107643 <default_alloc_pages+0x8c>
c010762b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010762e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return listelm->next;
c0107631:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107634:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c0107637:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010763a:	81 7d f0 44 e1 12 c0 	cmpl   $0xc012e144,-0x10(%ebp)
c0107641:	75 cc                	jne    c010760f <default_alloc_pages+0x58>
        }
    }
    if (page != NULL) {
c0107643:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107647:	0f 84 f8 00 00 00    	je     c0107745 <default_alloc_pages+0x18e>
        if (page->property > n) {
c010764d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107650:	8b 40 08             	mov    0x8(%eax),%eax
c0107653:	39 45 08             	cmp    %eax,0x8(%ebp)
c0107656:	0f 83 95 00 00 00    	jae    c01076f1 <default_alloc_pages+0x13a>
            struct Page *p = page + n;
c010765c:	8b 45 08             	mov    0x8(%ebp),%eax
c010765f:	c1 e0 05             	shl    $0x5,%eax
c0107662:	89 c2                	mov    %eax,%edx
c0107664:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107667:	01 d0                	add    %edx,%eax
c0107669:	89 45 e8             	mov    %eax,-0x18(%ebp)
            p->property = page->property - n;
c010766c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010766f:	8b 40 08             	mov    0x8(%eax),%eax
c0107672:	2b 45 08             	sub    0x8(%ebp),%eax
c0107675:	89 c2                	mov    %eax,%edx
c0107677:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010767a:	89 50 08             	mov    %edx,0x8(%eax)
            SetPageProperty(p);
c010767d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107680:	83 c0 04             	add    $0x4,%eax
c0107683:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
c010768a:	89 45 c0             	mov    %eax,-0x40(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c010768d:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0107690:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0107693:	0f ab 10             	bts    %edx,(%eax)
}
c0107696:	90                   	nop
            list_add(&(page->page_link), &(p->page_link));
c0107697:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010769a:	83 c0 0c             	add    $0xc,%eax
c010769d:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01076a0:	83 c2 0c             	add    $0xc,%edx
c01076a3:	89 55 e0             	mov    %edx,-0x20(%ebp)
c01076a6:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01076a9:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01076ac:	89 45 d8             	mov    %eax,-0x28(%ebp)
c01076af:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01076b2:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    __list_add(elm, listelm, listelm->next);
c01076b5:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01076b8:	8b 40 04             	mov    0x4(%eax),%eax
c01076bb:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01076be:	89 55 d0             	mov    %edx,-0x30(%ebp)
c01076c1:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01076c4:	89 55 cc             	mov    %edx,-0x34(%ebp)
c01076c7:	89 45 c8             	mov    %eax,-0x38(%ebp)
    prev->next = next->prev = elm;
c01076ca:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01076cd:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01076d0:	89 10                	mov    %edx,(%eax)
c01076d2:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01076d5:	8b 10                	mov    (%eax),%edx
c01076d7:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01076da:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01076dd:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01076e0:	8b 55 c8             	mov    -0x38(%ebp),%edx
c01076e3:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01076e6:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01076e9:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01076ec:	89 10                	mov    %edx,(%eax)
}
c01076ee:	90                   	nop
}
c01076ef:	90                   	nop
}
c01076f0:	90                   	nop
        }
        list_del(&(page->page_link));
c01076f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01076f4:	83 c0 0c             	add    $0xc,%eax
c01076f7:	89 45 b4             	mov    %eax,-0x4c(%ebp)
    __list_del(listelm->prev, listelm->next);
c01076fa:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01076fd:	8b 40 04             	mov    0x4(%eax),%eax
c0107700:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0107703:	8b 12                	mov    (%edx),%edx
c0107705:	89 55 b0             	mov    %edx,-0x50(%ebp)
c0107708:	89 45 ac             	mov    %eax,-0x54(%ebp)
    prev->next = next;
c010770b:	8b 45 b0             	mov    -0x50(%ebp),%eax
c010770e:	8b 55 ac             	mov    -0x54(%ebp),%edx
c0107711:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0107714:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0107717:	8b 55 b0             	mov    -0x50(%ebp),%edx
c010771a:	89 10                	mov    %edx,(%eax)
}
c010771c:	90                   	nop
}
c010771d:	90                   	nop
        nr_free -= n;
c010771e:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c0107723:	2b 45 08             	sub    0x8(%ebp),%eax
c0107726:	a3 4c e1 12 c0       	mov    %eax,0xc012e14c
        ClearPageProperty(page);
c010772b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010772e:	83 c0 04             	add    $0x4,%eax
c0107731:	c7 45 bc 01 00 00 00 	movl   $0x1,-0x44(%ebp)
c0107738:	89 45 b8             	mov    %eax,-0x48(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c010773b:	8b 45 b8             	mov    -0x48(%ebp),%eax
c010773e:	8b 55 bc             	mov    -0x44(%ebp),%edx
c0107741:	0f b3 10             	btr    %edx,(%eax)
}
c0107744:	90                   	nop
    }
    return page;
c0107745:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0107748:	c9                   	leave  
c0107749:	c3                   	ret    

c010774a <default_free_pages>:

static void
default_free_pages(struct Page *base, size_t n) {
c010774a:	f3 0f 1e fb          	endbr32 
c010774e:	55                   	push   %ebp
c010774f:	89 e5                	mov    %esp,%ebp
c0107751:	81 ec 98 00 00 00    	sub    $0x98,%esp
    assert(n > 0);
c0107757:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010775b:	75 24                	jne    c0107781 <default_free_pages+0x37>
c010775d:	c7 44 24 0c 3c bb 10 	movl   $0xc010bb3c,0xc(%esp)
c0107764:	c0 
c0107765:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c010776c:	c0 
c010776d:	c7 44 24 04 99 00 00 	movl   $0x99,0x4(%esp)
c0107774:	00 
c0107775:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c010777c:	e8 bc 8c ff ff       	call   c010043d <__panic>
    struct Page *p = base;
c0107781:	8b 45 08             	mov    0x8(%ebp),%eax
c0107784:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; p != base + n; p ++) {
c0107787:	e9 9d 00 00 00       	jmp    c0107829 <default_free_pages+0xdf>
        assert(!PageReserved(p) && !PageProperty(p));
c010778c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010778f:	83 c0 04             	add    $0x4,%eax
c0107792:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0107799:	89 45 e8             	mov    %eax,-0x18(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010779c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010779f:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01077a2:	0f a3 10             	bt     %edx,(%eax)
c01077a5:	19 c0                	sbb    %eax,%eax
c01077a7:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return oldbit != 0;
c01077aa:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01077ae:	0f 95 c0             	setne  %al
c01077b1:	0f b6 c0             	movzbl %al,%eax
c01077b4:	85 c0                	test   %eax,%eax
c01077b6:	75 2c                	jne    c01077e4 <default_free_pages+0x9a>
c01077b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01077bb:	83 c0 04             	add    $0x4,%eax
c01077be:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
c01077c5:	89 45 dc             	mov    %eax,-0x24(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01077c8:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01077cb:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01077ce:	0f a3 10             	bt     %edx,(%eax)
c01077d1:	19 c0                	sbb    %eax,%eax
c01077d3:	89 45 d8             	mov    %eax,-0x28(%ebp)
    return oldbit != 0;
c01077d6:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c01077da:	0f 95 c0             	setne  %al
c01077dd:	0f b6 c0             	movzbl %al,%eax
c01077e0:	85 c0                	test   %eax,%eax
c01077e2:	74 24                	je     c0107808 <default_free_pages+0xbe>
c01077e4:	c7 44 24 0c 80 bb 10 	movl   $0xc010bb80,0xc(%esp)
c01077eb:	c0 
c01077ec:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01077f3:	c0 
c01077f4:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
c01077fb:	00 
c01077fc:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107803:	e8 35 8c ff ff       	call   c010043d <__panic>
        p->flags = 0;
c0107808:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010780b:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
        set_page_ref(p, 0);
c0107812:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0107819:	00 
c010781a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010781d:	89 04 24             	mov    %eax,(%esp)
c0107820:	e8 f4 fb ff ff       	call   c0107419 <set_page_ref>
    for (; p != base + n; p ++) {
c0107825:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
c0107829:	8b 45 0c             	mov    0xc(%ebp),%eax
c010782c:	c1 e0 05             	shl    $0x5,%eax
c010782f:	89 c2                	mov    %eax,%edx
c0107831:	8b 45 08             	mov    0x8(%ebp),%eax
c0107834:	01 d0                	add    %edx,%eax
c0107836:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0107839:	0f 85 4d ff ff ff    	jne    c010778c <default_free_pages+0x42>
    }
    base->property = n;
c010783f:	8b 45 08             	mov    0x8(%ebp),%eax
c0107842:	8b 55 0c             	mov    0xc(%ebp),%edx
c0107845:	89 50 08             	mov    %edx,0x8(%eax)
    SetPageProperty(base);
c0107848:	8b 45 08             	mov    0x8(%ebp),%eax
c010784b:	83 c0 04             	add    $0x4,%eax
c010784e:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0107855:	89 45 cc             	mov    %eax,-0x34(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0107858:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010785b:	8b 55 d0             	mov    -0x30(%ebp),%edx
c010785e:	0f ab 10             	bts    %edx,(%eax)
}
c0107861:	90                   	nop
c0107862:	c7 45 d4 44 e1 12 c0 	movl   $0xc012e144,-0x2c(%ebp)
    return listelm->next;
c0107869:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010786c:	8b 40 04             	mov    0x4(%eax),%eax
    list_entry_t *le = list_next(&free_list);
c010786f:	89 45 f0             	mov    %eax,-0x10(%ebp)
    while (le != &free_list) {
c0107872:	e9 00 01 00 00       	jmp    c0107977 <default_free_pages+0x22d>
        p = le2page(le, page_link);
c0107877:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010787a:	83 e8 0c             	sub    $0xc,%eax
c010787d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107880:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107883:	89 45 c8             	mov    %eax,-0x38(%ebp)
c0107886:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0107889:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c010788c:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (base + base->property == p) {
c010788f:	8b 45 08             	mov    0x8(%ebp),%eax
c0107892:	8b 40 08             	mov    0x8(%eax),%eax
c0107895:	c1 e0 05             	shl    $0x5,%eax
c0107898:	89 c2                	mov    %eax,%edx
c010789a:	8b 45 08             	mov    0x8(%ebp),%eax
c010789d:	01 d0                	add    %edx,%eax
c010789f:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c01078a2:	75 5d                	jne    c0107901 <default_free_pages+0x1b7>
            base->property += p->property;
c01078a4:	8b 45 08             	mov    0x8(%ebp),%eax
c01078a7:	8b 50 08             	mov    0x8(%eax),%edx
c01078aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078ad:	8b 40 08             	mov    0x8(%eax),%eax
c01078b0:	01 c2                	add    %eax,%edx
c01078b2:	8b 45 08             	mov    0x8(%ebp),%eax
c01078b5:	89 50 08             	mov    %edx,0x8(%eax)
            ClearPageProperty(p);
c01078b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078bb:	83 c0 04             	add    $0x4,%eax
c01078be:	c7 45 b8 01 00 00 00 	movl   $0x1,-0x48(%ebp)
c01078c5:	89 45 b4             	mov    %eax,-0x4c(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c01078c8:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01078cb:	8b 55 b8             	mov    -0x48(%ebp),%edx
c01078ce:	0f b3 10             	btr    %edx,(%eax)
}
c01078d1:	90                   	nop
            list_del(&(p->page_link));
c01078d2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078d5:	83 c0 0c             	add    $0xc,%eax
c01078d8:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    __list_del(listelm->prev, listelm->next);
c01078db:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01078de:	8b 40 04             	mov    0x4(%eax),%eax
c01078e1:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c01078e4:	8b 12                	mov    (%edx),%edx
c01078e6:	89 55 c0             	mov    %edx,-0x40(%ebp)
c01078e9:	89 45 bc             	mov    %eax,-0x44(%ebp)
    prev->next = next;
c01078ec:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01078ef:	8b 55 bc             	mov    -0x44(%ebp),%edx
c01078f2:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c01078f5:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01078f8:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01078fb:	89 10                	mov    %edx,(%eax)
}
c01078fd:	90                   	nop
}
c01078fe:	90                   	nop
c01078ff:	eb 76                	jmp    c0107977 <default_free_pages+0x22d>
        }
        else if (p + p->property == base) {
c0107901:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107904:	8b 40 08             	mov    0x8(%eax),%eax
c0107907:	c1 e0 05             	shl    $0x5,%eax
c010790a:	89 c2                	mov    %eax,%edx
c010790c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010790f:	01 d0                	add    %edx,%eax
c0107911:	39 45 08             	cmp    %eax,0x8(%ebp)
c0107914:	75 61                	jne    c0107977 <default_free_pages+0x22d>
            p->property += base->property;
c0107916:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107919:	8b 50 08             	mov    0x8(%eax),%edx
c010791c:	8b 45 08             	mov    0x8(%ebp),%eax
c010791f:	8b 40 08             	mov    0x8(%eax),%eax
c0107922:	01 c2                	add    %eax,%edx
c0107924:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107927:	89 50 08             	mov    %edx,0x8(%eax)
            ClearPageProperty(base);
c010792a:	8b 45 08             	mov    0x8(%ebp),%eax
c010792d:	83 c0 04             	add    $0x4,%eax
c0107930:	c7 45 a4 01 00 00 00 	movl   $0x1,-0x5c(%ebp)
c0107937:	89 45 a0             	mov    %eax,-0x60(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c010793a:	8b 45 a0             	mov    -0x60(%ebp),%eax
c010793d:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0107940:	0f b3 10             	btr    %edx,(%eax)
}
c0107943:	90                   	nop
            base = p;
c0107944:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107947:	89 45 08             	mov    %eax,0x8(%ebp)
            list_del(&(p->page_link));
c010794a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010794d:	83 c0 0c             	add    $0xc,%eax
c0107950:	89 45 b0             	mov    %eax,-0x50(%ebp)
    __list_del(listelm->prev, listelm->next);
c0107953:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0107956:	8b 40 04             	mov    0x4(%eax),%eax
c0107959:	8b 55 b0             	mov    -0x50(%ebp),%edx
c010795c:	8b 12                	mov    (%edx),%edx
c010795e:	89 55 ac             	mov    %edx,-0x54(%ebp)
c0107961:	89 45 a8             	mov    %eax,-0x58(%ebp)
    prev->next = next;
c0107964:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0107967:	8b 55 a8             	mov    -0x58(%ebp),%edx
c010796a:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c010796d:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0107970:	8b 55 ac             	mov    -0x54(%ebp),%edx
c0107973:	89 10                	mov    %edx,(%eax)
}
c0107975:	90                   	nop
}
c0107976:	90                   	nop
    while (le != &free_list) {
c0107977:	81 7d f0 44 e1 12 c0 	cmpl   $0xc012e144,-0x10(%ebp)
c010797e:	0f 85 f3 fe ff ff    	jne    c0107877 <default_free_pages+0x12d>
        }
    }
    nr_free += n;
c0107984:	8b 15 4c e1 12 c0    	mov    0xc012e14c,%edx
c010798a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010798d:	01 d0                	add    %edx,%eax
c010798f:	a3 4c e1 12 c0       	mov    %eax,0xc012e14c
c0107994:	c7 45 9c 44 e1 12 c0 	movl   $0xc012e144,-0x64(%ebp)
    return listelm->next;
c010799b:	8b 45 9c             	mov    -0x64(%ebp),%eax
c010799e:	8b 40 04             	mov    0x4(%eax),%eax
    le = list_next(&free_list);
c01079a1:	89 45 f0             	mov    %eax,-0x10(%ebp)
    while (le != &free_list) {
c01079a4:	eb 20                	jmp    c01079c6 <default_free_pages+0x27c>
        p = le2page(le, page_link);
c01079a6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01079a9:	83 e8 0c             	sub    $0xc,%eax
c01079ac:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01079af:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01079b2:	89 45 98             	mov    %eax,-0x68(%ebp)
c01079b5:	8b 45 98             	mov    -0x68(%ebp),%eax
c01079b8:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c01079bb:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if(p>base) break;
c01079be:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01079c1:	3b 45 08             	cmp    0x8(%ebp),%eax
c01079c4:	77 0b                	ja     c01079d1 <default_free_pages+0x287>
    while (le != &free_list) {
c01079c6:	81 7d f0 44 e1 12 c0 	cmpl   $0xc012e144,-0x10(%ebp)
c01079cd:	75 d7                	jne    c01079a6 <default_free_pages+0x25c>
c01079cf:	eb 01                	jmp    c01079d2 <default_free_pages+0x288>
        if(p>base) break;
c01079d1:	90                   	nop
    }
    list_add_before(le,&(base->page_link));
c01079d2:	8b 45 08             	mov    0x8(%ebp),%eax
c01079d5:	8d 50 0c             	lea    0xc(%eax),%edx
c01079d8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01079db:	89 45 94             	mov    %eax,-0x6c(%ebp)
c01079de:	89 55 90             	mov    %edx,-0x70(%ebp)
    __list_add(elm, listelm->prev, listelm);
c01079e1:	8b 45 94             	mov    -0x6c(%ebp),%eax
c01079e4:	8b 00                	mov    (%eax),%eax
c01079e6:	8b 55 90             	mov    -0x70(%ebp),%edx
c01079e9:	89 55 8c             	mov    %edx,-0x74(%ebp)
c01079ec:	89 45 88             	mov    %eax,-0x78(%ebp)
c01079ef:	8b 45 94             	mov    -0x6c(%ebp),%eax
c01079f2:	89 45 84             	mov    %eax,-0x7c(%ebp)
    prev->next = next->prev = elm;
c01079f5:	8b 45 84             	mov    -0x7c(%ebp),%eax
c01079f8:	8b 55 8c             	mov    -0x74(%ebp),%edx
c01079fb:	89 10                	mov    %edx,(%eax)
c01079fd:	8b 45 84             	mov    -0x7c(%ebp),%eax
c0107a00:	8b 10                	mov    (%eax),%edx
c0107a02:	8b 45 88             	mov    -0x78(%ebp),%eax
c0107a05:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0107a08:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0107a0b:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0107a0e:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0107a11:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0107a14:	8b 55 88             	mov    -0x78(%ebp),%edx
c0107a17:	89 10                	mov    %edx,(%eax)
}
c0107a19:	90                   	nop
}
c0107a1a:	90                   	nop
}
c0107a1b:	90                   	nop
c0107a1c:	c9                   	leave  
c0107a1d:	c3                   	ret    

c0107a1e <default_nr_free_pages>:

static size_t
default_nr_free_pages(void) {
c0107a1e:	f3 0f 1e fb          	endbr32 
c0107a22:	55                   	push   %ebp
c0107a23:	89 e5                	mov    %esp,%ebp
    return nr_free;
c0107a25:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
}
c0107a2a:	5d                   	pop    %ebp
c0107a2b:	c3                   	ret    

c0107a2c <basic_check>:

static void
basic_check(void) {
c0107a2c:	f3 0f 1e fb          	endbr32 
c0107a30:	55                   	push   %ebp
c0107a31:	89 e5                	mov    %esp,%ebp
c0107a33:	83 ec 48             	sub    $0x48,%esp
    struct Page *p0, *p1, *p2;
    p0 = p1 = p2 = NULL;
c0107a36:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107a3d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107a40:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107a43:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107a46:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert((p0 = alloc_page()) != NULL);
c0107a49:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107a50:	e8 f2 bb ff ff       	call   c0103647 <alloc_pages>
c0107a55:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0107a58:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0107a5c:	75 24                	jne    c0107a82 <basic_check+0x56>
c0107a5e:	c7 44 24 0c a5 bb 10 	movl   $0xc010bba5,0xc(%esp)
c0107a65:	c0 
c0107a66:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107a6d:	c0 
c0107a6e:	c7 44 24 04 c5 00 00 	movl   $0xc5,0x4(%esp)
c0107a75:	00 
c0107a76:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107a7d:	e8 bb 89 ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_page()) != NULL);
c0107a82:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107a89:	e8 b9 bb ff ff       	call   c0103647 <alloc_pages>
c0107a8e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107a91:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107a95:	75 24                	jne    c0107abb <basic_check+0x8f>
c0107a97:	c7 44 24 0c c1 bb 10 	movl   $0xc010bbc1,0xc(%esp)
c0107a9e:	c0 
c0107a9f:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107aa6:	c0 
c0107aa7:	c7 44 24 04 c6 00 00 	movl   $0xc6,0x4(%esp)
c0107aae:	00 
c0107aaf:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107ab6:	e8 82 89 ff ff       	call   c010043d <__panic>
    assert((p2 = alloc_page()) != NULL);
c0107abb:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107ac2:	e8 80 bb ff ff       	call   c0103647 <alloc_pages>
c0107ac7:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107aca:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107ace:	75 24                	jne    c0107af4 <basic_check+0xc8>
c0107ad0:	c7 44 24 0c dd bb 10 	movl   $0xc010bbdd,0xc(%esp)
c0107ad7:	c0 
c0107ad8:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107adf:	c0 
c0107ae0:	c7 44 24 04 c7 00 00 	movl   $0xc7,0x4(%esp)
c0107ae7:	00 
c0107ae8:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107aef:	e8 49 89 ff ff       	call   c010043d <__panic>

    assert(p0 != p1 && p0 != p2 && p1 != p2);
c0107af4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107af7:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0107afa:	74 10                	je     c0107b0c <basic_check+0xe0>
c0107afc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107aff:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0107b02:	74 08                	je     c0107b0c <basic_check+0xe0>
c0107b04:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107b07:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0107b0a:	75 24                	jne    c0107b30 <basic_check+0x104>
c0107b0c:	c7 44 24 0c fc bb 10 	movl   $0xc010bbfc,0xc(%esp)
c0107b13:	c0 
c0107b14:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107b1b:	c0 
c0107b1c:	c7 44 24 04 c9 00 00 	movl   $0xc9,0x4(%esp)
c0107b23:	00 
c0107b24:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107b2b:	e8 0d 89 ff ff       	call   c010043d <__panic>
    assert(page_ref(p0) == 0 && page_ref(p1) == 0 && page_ref(p2) == 0);
c0107b30:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107b33:	89 04 24             	mov    %eax,(%esp)
c0107b36:	e8 d4 f8 ff ff       	call   c010740f <page_ref>
c0107b3b:	85 c0                	test   %eax,%eax
c0107b3d:	75 1e                	jne    c0107b5d <basic_check+0x131>
c0107b3f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107b42:	89 04 24             	mov    %eax,(%esp)
c0107b45:	e8 c5 f8 ff ff       	call   c010740f <page_ref>
c0107b4a:	85 c0                	test   %eax,%eax
c0107b4c:	75 0f                	jne    c0107b5d <basic_check+0x131>
c0107b4e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107b51:	89 04 24             	mov    %eax,(%esp)
c0107b54:	e8 b6 f8 ff ff       	call   c010740f <page_ref>
c0107b59:	85 c0                	test   %eax,%eax
c0107b5b:	74 24                	je     c0107b81 <basic_check+0x155>
c0107b5d:	c7 44 24 0c 20 bc 10 	movl   $0xc010bc20,0xc(%esp)
c0107b64:	c0 
c0107b65:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107b6c:	c0 
c0107b6d:	c7 44 24 04 ca 00 00 	movl   $0xca,0x4(%esp)
c0107b74:	00 
c0107b75:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107b7c:	e8 bc 88 ff ff       	call   c010043d <__panic>

    assert(page2pa(p0) < npage * PGSIZE);
c0107b81:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107b84:	89 04 24             	mov    %eax,(%esp)
c0107b87:	e8 6d f8 ff ff       	call   c01073f9 <page2pa>
c0107b8c:	8b 15 80 bf 12 c0    	mov    0xc012bf80,%edx
c0107b92:	c1 e2 0c             	shl    $0xc,%edx
c0107b95:	39 d0                	cmp    %edx,%eax
c0107b97:	72 24                	jb     c0107bbd <basic_check+0x191>
c0107b99:	c7 44 24 0c 5c bc 10 	movl   $0xc010bc5c,0xc(%esp)
c0107ba0:	c0 
c0107ba1:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107ba8:	c0 
c0107ba9:	c7 44 24 04 cc 00 00 	movl   $0xcc,0x4(%esp)
c0107bb0:	00 
c0107bb1:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107bb8:	e8 80 88 ff ff       	call   c010043d <__panic>
    assert(page2pa(p1) < npage * PGSIZE);
c0107bbd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107bc0:	89 04 24             	mov    %eax,(%esp)
c0107bc3:	e8 31 f8 ff ff       	call   c01073f9 <page2pa>
c0107bc8:	8b 15 80 bf 12 c0    	mov    0xc012bf80,%edx
c0107bce:	c1 e2 0c             	shl    $0xc,%edx
c0107bd1:	39 d0                	cmp    %edx,%eax
c0107bd3:	72 24                	jb     c0107bf9 <basic_check+0x1cd>
c0107bd5:	c7 44 24 0c 79 bc 10 	movl   $0xc010bc79,0xc(%esp)
c0107bdc:	c0 
c0107bdd:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107be4:	c0 
c0107be5:	c7 44 24 04 cd 00 00 	movl   $0xcd,0x4(%esp)
c0107bec:	00 
c0107bed:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107bf4:	e8 44 88 ff ff       	call   c010043d <__panic>
    assert(page2pa(p2) < npage * PGSIZE);
c0107bf9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107bfc:	89 04 24             	mov    %eax,(%esp)
c0107bff:	e8 f5 f7 ff ff       	call   c01073f9 <page2pa>
c0107c04:	8b 15 80 bf 12 c0    	mov    0xc012bf80,%edx
c0107c0a:	c1 e2 0c             	shl    $0xc,%edx
c0107c0d:	39 d0                	cmp    %edx,%eax
c0107c0f:	72 24                	jb     c0107c35 <basic_check+0x209>
c0107c11:	c7 44 24 0c 96 bc 10 	movl   $0xc010bc96,0xc(%esp)
c0107c18:	c0 
c0107c19:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107c20:	c0 
c0107c21:	c7 44 24 04 ce 00 00 	movl   $0xce,0x4(%esp)
c0107c28:	00 
c0107c29:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107c30:	e8 08 88 ff ff       	call   c010043d <__panic>

    list_entry_t free_list_store = free_list;
c0107c35:	a1 44 e1 12 c0       	mov    0xc012e144,%eax
c0107c3a:	8b 15 48 e1 12 c0    	mov    0xc012e148,%edx
c0107c40:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0107c43:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0107c46:	c7 45 dc 44 e1 12 c0 	movl   $0xc012e144,-0x24(%ebp)
    elm->prev = elm->next = elm;
c0107c4d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107c50:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0107c53:	89 50 04             	mov    %edx,0x4(%eax)
c0107c56:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107c59:	8b 50 04             	mov    0x4(%eax),%edx
c0107c5c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107c5f:	89 10                	mov    %edx,(%eax)
}
c0107c61:	90                   	nop
c0107c62:	c7 45 e0 44 e1 12 c0 	movl   $0xc012e144,-0x20(%ebp)
    return list->next == list;
c0107c69:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107c6c:	8b 40 04             	mov    0x4(%eax),%eax
c0107c6f:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0107c72:	0f 94 c0             	sete   %al
c0107c75:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c0107c78:	85 c0                	test   %eax,%eax
c0107c7a:	75 24                	jne    c0107ca0 <basic_check+0x274>
c0107c7c:	c7 44 24 0c b3 bc 10 	movl   $0xc010bcb3,0xc(%esp)
c0107c83:	c0 
c0107c84:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107c8b:	c0 
c0107c8c:	c7 44 24 04 d2 00 00 	movl   $0xd2,0x4(%esp)
c0107c93:	00 
c0107c94:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107c9b:	e8 9d 87 ff ff       	call   c010043d <__panic>

    unsigned int nr_free_store = nr_free;
c0107ca0:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c0107ca5:	89 45 e8             	mov    %eax,-0x18(%ebp)
    nr_free = 0;
c0107ca8:	c7 05 4c e1 12 c0 00 	movl   $0x0,0xc012e14c
c0107caf:	00 00 00 

    assert(alloc_page() == NULL);
c0107cb2:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107cb9:	e8 89 b9 ff ff       	call   c0103647 <alloc_pages>
c0107cbe:	85 c0                	test   %eax,%eax
c0107cc0:	74 24                	je     c0107ce6 <basic_check+0x2ba>
c0107cc2:	c7 44 24 0c ca bc 10 	movl   $0xc010bcca,0xc(%esp)
c0107cc9:	c0 
c0107cca:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107cd1:	c0 
c0107cd2:	c7 44 24 04 d7 00 00 	movl   $0xd7,0x4(%esp)
c0107cd9:	00 
c0107cda:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107ce1:	e8 57 87 ff ff       	call   c010043d <__panic>

    free_page(p0);
c0107ce6:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107ced:	00 
c0107cee:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107cf1:	89 04 24             	mov    %eax,(%esp)
c0107cf4:	e8 bd b9 ff ff       	call   c01036b6 <free_pages>
    free_page(p1);
c0107cf9:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107d00:	00 
c0107d01:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107d04:	89 04 24             	mov    %eax,(%esp)
c0107d07:	e8 aa b9 ff ff       	call   c01036b6 <free_pages>
    free_page(p2);
c0107d0c:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107d13:	00 
c0107d14:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107d17:	89 04 24             	mov    %eax,(%esp)
c0107d1a:	e8 97 b9 ff ff       	call   c01036b6 <free_pages>
    assert(nr_free == 3);
c0107d1f:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c0107d24:	83 f8 03             	cmp    $0x3,%eax
c0107d27:	74 24                	je     c0107d4d <basic_check+0x321>
c0107d29:	c7 44 24 0c df bc 10 	movl   $0xc010bcdf,0xc(%esp)
c0107d30:	c0 
c0107d31:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107d38:	c0 
c0107d39:	c7 44 24 04 dc 00 00 	movl   $0xdc,0x4(%esp)
c0107d40:	00 
c0107d41:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107d48:	e8 f0 86 ff ff       	call   c010043d <__panic>

    assert((p0 = alloc_page()) != NULL);
c0107d4d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107d54:	e8 ee b8 ff ff       	call   c0103647 <alloc_pages>
c0107d59:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0107d5c:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0107d60:	75 24                	jne    c0107d86 <basic_check+0x35a>
c0107d62:	c7 44 24 0c a5 bb 10 	movl   $0xc010bba5,0xc(%esp)
c0107d69:	c0 
c0107d6a:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107d71:	c0 
c0107d72:	c7 44 24 04 de 00 00 	movl   $0xde,0x4(%esp)
c0107d79:	00 
c0107d7a:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107d81:	e8 b7 86 ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_page()) != NULL);
c0107d86:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107d8d:	e8 b5 b8 ff ff       	call   c0103647 <alloc_pages>
c0107d92:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107d95:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107d99:	75 24                	jne    c0107dbf <basic_check+0x393>
c0107d9b:	c7 44 24 0c c1 bb 10 	movl   $0xc010bbc1,0xc(%esp)
c0107da2:	c0 
c0107da3:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107daa:	c0 
c0107dab:	c7 44 24 04 df 00 00 	movl   $0xdf,0x4(%esp)
c0107db2:	00 
c0107db3:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107dba:	e8 7e 86 ff ff       	call   c010043d <__panic>
    assert((p2 = alloc_page()) != NULL);
c0107dbf:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107dc6:	e8 7c b8 ff ff       	call   c0103647 <alloc_pages>
c0107dcb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107dce:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107dd2:	75 24                	jne    c0107df8 <basic_check+0x3cc>
c0107dd4:	c7 44 24 0c dd bb 10 	movl   $0xc010bbdd,0xc(%esp)
c0107ddb:	c0 
c0107ddc:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107de3:	c0 
c0107de4:	c7 44 24 04 e0 00 00 	movl   $0xe0,0x4(%esp)
c0107deb:	00 
c0107dec:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107df3:	e8 45 86 ff ff       	call   c010043d <__panic>

    assert(alloc_page() == NULL);
c0107df8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107dff:	e8 43 b8 ff ff       	call   c0103647 <alloc_pages>
c0107e04:	85 c0                	test   %eax,%eax
c0107e06:	74 24                	je     c0107e2c <basic_check+0x400>
c0107e08:	c7 44 24 0c ca bc 10 	movl   $0xc010bcca,0xc(%esp)
c0107e0f:	c0 
c0107e10:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107e17:	c0 
c0107e18:	c7 44 24 04 e2 00 00 	movl   $0xe2,0x4(%esp)
c0107e1f:	00 
c0107e20:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107e27:	e8 11 86 ff ff       	call   c010043d <__panic>

    free_page(p0);
c0107e2c:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107e33:	00 
c0107e34:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107e37:	89 04 24             	mov    %eax,(%esp)
c0107e3a:	e8 77 b8 ff ff       	call   c01036b6 <free_pages>
c0107e3f:	c7 45 d8 44 e1 12 c0 	movl   $0xc012e144,-0x28(%ebp)
c0107e46:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0107e49:	8b 40 04             	mov    0x4(%eax),%eax
c0107e4c:	39 45 d8             	cmp    %eax,-0x28(%ebp)
c0107e4f:	0f 94 c0             	sete   %al
c0107e52:	0f b6 c0             	movzbl %al,%eax
    assert(!list_empty(&free_list));
c0107e55:	85 c0                	test   %eax,%eax
c0107e57:	74 24                	je     c0107e7d <basic_check+0x451>
c0107e59:	c7 44 24 0c ec bc 10 	movl   $0xc010bcec,0xc(%esp)
c0107e60:	c0 
c0107e61:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107e68:	c0 
c0107e69:	c7 44 24 04 e5 00 00 	movl   $0xe5,0x4(%esp)
c0107e70:	00 
c0107e71:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107e78:	e8 c0 85 ff ff       	call   c010043d <__panic>

    struct Page *p;
    assert((p = alloc_page()) == p0);
c0107e7d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107e84:	e8 be b7 ff ff       	call   c0103647 <alloc_pages>
c0107e89:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0107e8c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107e8f:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0107e92:	74 24                	je     c0107eb8 <basic_check+0x48c>
c0107e94:	c7 44 24 0c 04 bd 10 	movl   $0xc010bd04,0xc(%esp)
c0107e9b:	c0 
c0107e9c:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107ea3:	c0 
c0107ea4:	c7 44 24 04 e8 00 00 	movl   $0xe8,0x4(%esp)
c0107eab:	00 
c0107eac:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107eb3:	e8 85 85 ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c0107eb8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107ebf:	e8 83 b7 ff ff       	call   c0103647 <alloc_pages>
c0107ec4:	85 c0                	test   %eax,%eax
c0107ec6:	74 24                	je     c0107eec <basic_check+0x4c0>
c0107ec8:	c7 44 24 0c ca bc 10 	movl   $0xc010bcca,0xc(%esp)
c0107ecf:	c0 
c0107ed0:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107ed7:	c0 
c0107ed8:	c7 44 24 04 e9 00 00 	movl   $0xe9,0x4(%esp)
c0107edf:	00 
c0107ee0:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107ee7:	e8 51 85 ff ff       	call   c010043d <__panic>

    assert(nr_free == 0);
c0107eec:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c0107ef1:	85 c0                	test   %eax,%eax
c0107ef3:	74 24                	je     c0107f19 <basic_check+0x4ed>
c0107ef5:	c7 44 24 0c 1d bd 10 	movl   $0xc010bd1d,0xc(%esp)
c0107efc:	c0 
c0107efd:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107f04:	c0 
c0107f05:	c7 44 24 04 eb 00 00 	movl   $0xeb,0x4(%esp)
c0107f0c:	00 
c0107f0d:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107f14:	e8 24 85 ff ff       	call   c010043d <__panic>
    free_list = free_list_store;
c0107f19:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107f1c:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0107f1f:	a3 44 e1 12 c0       	mov    %eax,0xc012e144
c0107f24:	89 15 48 e1 12 c0    	mov    %edx,0xc012e148
    nr_free = nr_free_store;
c0107f2a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107f2d:	a3 4c e1 12 c0       	mov    %eax,0xc012e14c

    free_page(p);
c0107f32:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107f39:	00 
c0107f3a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107f3d:	89 04 24             	mov    %eax,(%esp)
c0107f40:	e8 71 b7 ff ff       	call   c01036b6 <free_pages>
    free_page(p1);
c0107f45:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107f4c:	00 
c0107f4d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107f50:	89 04 24             	mov    %eax,(%esp)
c0107f53:	e8 5e b7 ff ff       	call   c01036b6 <free_pages>
    free_page(p2);
c0107f58:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107f5f:	00 
c0107f60:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107f63:	89 04 24             	mov    %eax,(%esp)
c0107f66:	e8 4b b7 ff ff       	call   c01036b6 <free_pages>
}
c0107f6b:	90                   	nop
c0107f6c:	c9                   	leave  
c0107f6d:	c3                   	ret    

c0107f6e <default_check>:

// LAB2: below code is used to check the first fit allocation algorithm (your EXERCISE 1) 
// NOTICE: You SHOULD NOT CHANGE basic_check, default_check functions!
static void
default_check(void) {
c0107f6e:	f3 0f 1e fb          	endbr32 
c0107f72:	55                   	push   %ebp
c0107f73:	89 e5                	mov    %esp,%ebp
c0107f75:	81 ec 98 00 00 00    	sub    $0x98,%esp
    int count = 0, total = 0;
c0107f7b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107f82:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    list_entry_t *le = &free_list;
c0107f89:	c7 45 ec 44 e1 12 c0 	movl   $0xc012e144,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c0107f90:	eb 6a                	jmp    c0107ffc <default_check+0x8e>
        struct Page *p = le2page(le, page_link);
c0107f92:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107f95:	83 e8 0c             	sub    $0xc,%eax
c0107f98:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        assert(PageProperty(p));
c0107f9b:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0107f9e:	83 c0 04             	add    $0x4,%eax
c0107fa1:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0107fa8:	89 45 cc             	mov    %eax,-0x34(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0107fab:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0107fae:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0107fb1:	0f a3 10             	bt     %edx,(%eax)
c0107fb4:	19 c0                	sbb    %eax,%eax
c0107fb6:	89 45 c8             	mov    %eax,-0x38(%ebp)
    return oldbit != 0;
c0107fb9:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c0107fbd:	0f 95 c0             	setne  %al
c0107fc0:	0f b6 c0             	movzbl %al,%eax
c0107fc3:	85 c0                	test   %eax,%eax
c0107fc5:	75 24                	jne    c0107feb <default_check+0x7d>
c0107fc7:	c7 44 24 0c 2a bd 10 	movl   $0xc010bd2a,0xc(%esp)
c0107fce:	c0 
c0107fcf:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0107fd6:	c0 
c0107fd7:	c7 44 24 04 fc 00 00 	movl   $0xfc,0x4(%esp)
c0107fde:	00 
c0107fdf:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0107fe6:	e8 52 84 ff ff       	call   c010043d <__panic>
        count ++, total += p->property;
c0107feb:	ff 45 f4             	incl   -0xc(%ebp)
c0107fee:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0107ff1:	8b 50 08             	mov    0x8(%eax),%edx
c0107ff4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107ff7:	01 d0                	add    %edx,%eax
c0107ff9:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107ffc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107fff:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    return listelm->next;
c0108002:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0108005:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c0108008:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010800b:	81 7d ec 44 e1 12 c0 	cmpl   $0xc012e144,-0x14(%ebp)
c0108012:	0f 85 7a ff ff ff    	jne    c0107f92 <default_check+0x24>
    }
    assert(total == nr_free_pages());
c0108018:	e8 d0 b6 ff ff       	call   c01036ed <nr_free_pages>
c010801d:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108020:	39 d0                	cmp    %edx,%eax
c0108022:	74 24                	je     c0108048 <default_check+0xda>
c0108024:	c7 44 24 0c 3a bd 10 	movl   $0xc010bd3a,0xc(%esp)
c010802b:	c0 
c010802c:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0108033:	c0 
c0108034:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
c010803b:	00 
c010803c:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0108043:	e8 f5 83 ff ff       	call   c010043d <__panic>

    basic_check();
c0108048:	e8 df f9 ff ff       	call   c0107a2c <basic_check>

    struct Page *p0 = alloc_pages(5), *p1, *p2;
c010804d:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c0108054:	e8 ee b5 ff ff       	call   c0103647 <alloc_pages>
c0108059:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(p0 != NULL);
c010805c:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0108060:	75 24                	jne    c0108086 <default_check+0x118>
c0108062:	c7 44 24 0c 53 bd 10 	movl   $0xc010bd53,0xc(%esp)
c0108069:	c0 
c010806a:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0108071:	c0 
c0108072:	c7 44 24 04 04 01 00 	movl   $0x104,0x4(%esp)
c0108079:	00 
c010807a:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0108081:	e8 b7 83 ff ff       	call   c010043d <__panic>
    assert(!PageProperty(p0));
c0108086:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108089:	83 c0 04             	add    $0x4,%eax
c010808c:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c0108093:	89 45 bc             	mov    %eax,-0x44(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0108096:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0108099:	8b 55 c0             	mov    -0x40(%ebp),%edx
c010809c:	0f a3 10             	bt     %edx,(%eax)
c010809f:	19 c0                	sbb    %eax,%eax
c01080a1:	89 45 b8             	mov    %eax,-0x48(%ebp)
    return oldbit != 0;
c01080a4:	83 7d b8 00          	cmpl   $0x0,-0x48(%ebp)
c01080a8:	0f 95 c0             	setne  %al
c01080ab:	0f b6 c0             	movzbl %al,%eax
c01080ae:	85 c0                	test   %eax,%eax
c01080b0:	74 24                	je     c01080d6 <default_check+0x168>
c01080b2:	c7 44 24 0c 5e bd 10 	movl   $0xc010bd5e,0xc(%esp)
c01080b9:	c0 
c01080ba:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01080c1:	c0 
c01080c2:	c7 44 24 04 05 01 00 	movl   $0x105,0x4(%esp)
c01080c9:	00 
c01080ca:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01080d1:	e8 67 83 ff ff       	call   c010043d <__panic>

    list_entry_t free_list_store = free_list;
c01080d6:	a1 44 e1 12 c0       	mov    0xc012e144,%eax
c01080db:	8b 15 48 e1 12 c0    	mov    0xc012e148,%edx
c01080e1:	89 45 80             	mov    %eax,-0x80(%ebp)
c01080e4:	89 55 84             	mov    %edx,-0x7c(%ebp)
c01080e7:	c7 45 b0 44 e1 12 c0 	movl   $0xc012e144,-0x50(%ebp)
    elm->prev = elm->next = elm;
c01080ee:	8b 45 b0             	mov    -0x50(%ebp),%eax
c01080f1:	8b 55 b0             	mov    -0x50(%ebp),%edx
c01080f4:	89 50 04             	mov    %edx,0x4(%eax)
c01080f7:	8b 45 b0             	mov    -0x50(%ebp),%eax
c01080fa:	8b 50 04             	mov    0x4(%eax),%edx
c01080fd:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0108100:	89 10                	mov    %edx,(%eax)
}
c0108102:	90                   	nop
c0108103:	c7 45 b4 44 e1 12 c0 	movl   $0xc012e144,-0x4c(%ebp)
    return list->next == list;
c010810a:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010810d:	8b 40 04             	mov    0x4(%eax),%eax
c0108110:	39 45 b4             	cmp    %eax,-0x4c(%ebp)
c0108113:	0f 94 c0             	sete   %al
c0108116:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c0108119:	85 c0                	test   %eax,%eax
c010811b:	75 24                	jne    c0108141 <default_check+0x1d3>
c010811d:	c7 44 24 0c b3 bc 10 	movl   $0xc010bcb3,0xc(%esp)
c0108124:	c0 
c0108125:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c010812c:	c0 
c010812d:	c7 44 24 04 09 01 00 	movl   $0x109,0x4(%esp)
c0108134:	00 
c0108135:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c010813c:	e8 fc 82 ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c0108141:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108148:	e8 fa b4 ff ff       	call   c0103647 <alloc_pages>
c010814d:	85 c0                	test   %eax,%eax
c010814f:	74 24                	je     c0108175 <default_check+0x207>
c0108151:	c7 44 24 0c ca bc 10 	movl   $0xc010bcca,0xc(%esp)
c0108158:	c0 
c0108159:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0108160:	c0 
c0108161:	c7 44 24 04 0a 01 00 	movl   $0x10a,0x4(%esp)
c0108168:	00 
c0108169:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0108170:	e8 c8 82 ff ff       	call   c010043d <__panic>

    unsigned int nr_free_store = nr_free;
c0108175:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c010817a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    nr_free = 0;
c010817d:	c7 05 4c e1 12 c0 00 	movl   $0x0,0xc012e14c
c0108184:	00 00 00 

    free_pages(p0 + 2, 3);
c0108187:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010818a:	83 c0 40             	add    $0x40,%eax
c010818d:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c0108194:	00 
c0108195:	89 04 24             	mov    %eax,(%esp)
c0108198:	e8 19 b5 ff ff       	call   c01036b6 <free_pages>
    assert(alloc_pages(4) == NULL);
c010819d:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c01081a4:	e8 9e b4 ff ff       	call   c0103647 <alloc_pages>
c01081a9:	85 c0                	test   %eax,%eax
c01081ab:	74 24                	je     c01081d1 <default_check+0x263>
c01081ad:	c7 44 24 0c 70 bd 10 	movl   $0xc010bd70,0xc(%esp)
c01081b4:	c0 
c01081b5:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01081bc:	c0 
c01081bd:	c7 44 24 04 10 01 00 	movl   $0x110,0x4(%esp)
c01081c4:	00 
c01081c5:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01081cc:	e8 6c 82 ff ff       	call   c010043d <__panic>
    assert(PageProperty(p0 + 2) && p0[2].property == 3);
c01081d1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01081d4:	83 c0 40             	add    $0x40,%eax
c01081d7:	83 c0 04             	add    $0x4,%eax
c01081da:	c7 45 ac 01 00 00 00 	movl   $0x1,-0x54(%ebp)
c01081e1:	89 45 a8             	mov    %eax,-0x58(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01081e4:	8b 45 a8             	mov    -0x58(%ebp),%eax
c01081e7:	8b 55 ac             	mov    -0x54(%ebp),%edx
c01081ea:	0f a3 10             	bt     %edx,(%eax)
c01081ed:	19 c0                	sbb    %eax,%eax
c01081ef:	89 45 a4             	mov    %eax,-0x5c(%ebp)
    return oldbit != 0;
c01081f2:	83 7d a4 00          	cmpl   $0x0,-0x5c(%ebp)
c01081f6:	0f 95 c0             	setne  %al
c01081f9:	0f b6 c0             	movzbl %al,%eax
c01081fc:	85 c0                	test   %eax,%eax
c01081fe:	74 0e                	je     c010820e <default_check+0x2a0>
c0108200:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108203:	83 c0 40             	add    $0x40,%eax
c0108206:	8b 40 08             	mov    0x8(%eax),%eax
c0108209:	83 f8 03             	cmp    $0x3,%eax
c010820c:	74 24                	je     c0108232 <default_check+0x2c4>
c010820e:	c7 44 24 0c 88 bd 10 	movl   $0xc010bd88,0xc(%esp)
c0108215:	c0 
c0108216:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c010821d:	c0 
c010821e:	c7 44 24 04 11 01 00 	movl   $0x111,0x4(%esp)
c0108225:	00 
c0108226:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c010822d:	e8 0b 82 ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_pages(3)) != NULL);
c0108232:	c7 04 24 03 00 00 00 	movl   $0x3,(%esp)
c0108239:	e8 09 b4 ff ff       	call   c0103647 <alloc_pages>
c010823e:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0108241:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0108245:	75 24                	jne    c010826b <default_check+0x2fd>
c0108247:	c7 44 24 0c b4 bd 10 	movl   $0xc010bdb4,0xc(%esp)
c010824e:	c0 
c010824f:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0108256:	c0 
c0108257:	c7 44 24 04 12 01 00 	movl   $0x112,0x4(%esp)
c010825e:	00 
c010825f:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0108266:	e8 d2 81 ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c010826b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108272:	e8 d0 b3 ff ff       	call   c0103647 <alloc_pages>
c0108277:	85 c0                	test   %eax,%eax
c0108279:	74 24                	je     c010829f <default_check+0x331>
c010827b:	c7 44 24 0c ca bc 10 	movl   $0xc010bcca,0xc(%esp)
c0108282:	c0 
c0108283:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c010828a:	c0 
c010828b:	c7 44 24 04 13 01 00 	movl   $0x113,0x4(%esp)
c0108292:	00 
c0108293:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c010829a:	e8 9e 81 ff ff       	call   c010043d <__panic>
    assert(p0 + 2 == p1);
c010829f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01082a2:	83 c0 40             	add    $0x40,%eax
c01082a5:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c01082a8:	74 24                	je     c01082ce <default_check+0x360>
c01082aa:	c7 44 24 0c d2 bd 10 	movl   $0xc010bdd2,0xc(%esp)
c01082b1:	c0 
c01082b2:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01082b9:	c0 
c01082ba:	c7 44 24 04 14 01 00 	movl   $0x114,0x4(%esp)
c01082c1:	00 
c01082c2:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01082c9:	e8 6f 81 ff ff       	call   c010043d <__panic>

    p2 = p0 + 1;
c01082ce:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01082d1:	83 c0 20             	add    $0x20,%eax
c01082d4:	89 45 dc             	mov    %eax,-0x24(%ebp)
    free_page(p0);
c01082d7:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01082de:	00 
c01082df:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01082e2:	89 04 24             	mov    %eax,(%esp)
c01082e5:	e8 cc b3 ff ff       	call   c01036b6 <free_pages>
    free_pages(p1, 3);
c01082ea:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c01082f1:	00 
c01082f2:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01082f5:	89 04 24             	mov    %eax,(%esp)
c01082f8:	e8 b9 b3 ff ff       	call   c01036b6 <free_pages>
    assert(PageProperty(p0) && p0->property == 1);
c01082fd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108300:	83 c0 04             	add    $0x4,%eax
c0108303:	c7 45 a0 01 00 00 00 	movl   $0x1,-0x60(%ebp)
c010830a:	89 45 9c             	mov    %eax,-0x64(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010830d:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0108310:	8b 55 a0             	mov    -0x60(%ebp),%edx
c0108313:	0f a3 10             	bt     %edx,(%eax)
c0108316:	19 c0                	sbb    %eax,%eax
c0108318:	89 45 98             	mov    %eax,-0x68(%ebp)
    return oldbit != 0;
c010831b:	83 7d 98 00          	cmpl   $0x0,-0x68(%ebp)
c010831f:	0f 95 c0             	setne  %al
c0108322:	0f b6 c0             	movzbl %al,%eax
c0108325:	85 c0                	test   %eax,%eax
c0108327:	74 0b                	je     c0108334 <default_check+0x3c6>
c0108329:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010832c:	8b 40 08             	mov    0x8(%eax),%eax
c010832f:	83 f8 01             	cmp    $0x1,%eax
c0108332:	74 24                	je     c0108358 <default_check+0x3ea>
c0108334:	c7 44 24 0c e0 bd 10 	movl   $0xc010bde0,0xc(%esp)
c010833b:	c0 
c010833c:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0108343:	c0 
c0108344:	c7 44 24 04 19 01 00 	movl   $0x119,0x4(%esp)
c010834b:	00 
c010834c:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0108353:	e8 e5 80 ff ff       	call   c010043d <__panic>
    assert(PageProperty(p1) && p1->property == 3);
c0108358:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010835b:	83 c0 04             	add    $0x4,%eax
c010835e:	c7 45 94 01 00 00 00 	movl   $0x1,-0x6c(%ebp)
c0108365:	89 45 90             	mov    %eax,-0x70(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0108368:	8b 45 90             	mov    -0x70(%ebp),%eax
c010836b:	8b 55 94             	mov    -0x6c(%ebp),%edx
c010836e:	0f a3 10             	bt     %edx,(%eax)
c0108371:	19 c0                	sbb    %eax,%eax
c0108373:	89 45 8c             	mov    %eax,-0x74(%ebp)
    return oldbit != 0;
c0108376:	83 7d 8c 00          	cmpl   $0x0,-0x74(%ebp)
c010837a:	0f 95 c0             	setne  %al
c010837d:	0f b6 c0             	movzbl %al,%eax
c0108380:	85 c0                	test   %eax,%eax
c0108382:	74 0b                	je     c010838f <default_check+0x421>
c0108384:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108387:	8b 40 08             	mov    0x8(%eax),%eax
c010838a:	83 f8 03             	cmp    $0x3,%eax
c010838d:	74 24                	je     c01083b3 <default_check+0x445>
c010838f:	c7 44 24 0c 08 be 10 	movl   $0xc010be08,0xc(%esp)
c0108396:	c0 
c0108397:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c010839e:	c0 
c010839f:	c7 44 24 04 1a 01 00 	movl   $0x11a,0x4(%esp)
c01083a6:	00 
c01083a7:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01083ae:	e8 8a 80 ff ff       	call   c010043d <__panic>

    assert((p0 = alloc_page()) == p2 - 1);
c01083b3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01083ba:	e8 88 b2 ff ff       	call   c0103647 <alloc_pages>
c01083bf:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01083c2:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01083c5:	83 e8 20             	sub    $0x20,%eax
c01083c8:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c01083cb:	74 24                	je     c01083f1 <default_check+0x483>
c01083cd:	c7 44 24 0c 2e be 10 	movl   $0xc010be2e,0xc(%esp)
c01083d4:	c0 
c01083d5:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01083dc:	c0 
c01083dd:	c7 44 24 04 1c 01 00 	movl   $0x11c,0x4(%esp)
c01083e4:	00 
c01083e5:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01083ec:	e8 4c 80 ff ff       	call   c010043d <__panic>
    free_page(p0);
c01083f1:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01083f8:	00 
c01083f9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01083fc:	89 04 24             	mov    %eax,(%esp)
c01083ff:	e8 b2 b2 ff ff       	call   c01036b6 <free_pages>
    assert((p0 = alloc_pages(2)) == p2 + 1);
c0108404:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c010840b:	e8 37 b2 ff ff       	call   c0103647 <alloc_pages>
c0108410:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108413:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108416:	83 c0 20             	add    $0x20,%eax
c0108419:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c010841c:	74 24                	je     c0108442 <default_check+0x4d4>
c010841e:	c7 44 24 0c 4c be 10 	movl   $0xc010be4c,0xc(%esp)
c0108425:	c0 
c0108426:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c010842d:	c0 
c010842e:	c7 44 24 04 1e 01 00 	movl   $0x11e,0x4(%esp)
c0108435:	00 
c0108436:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c010843d:	e8 fb 7f ff ff       	call   c010043d <__panic>

    free_pages(p0, 2);
c0108442:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c0108449:	00 
c010844a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010844d:	89 04 24             	mov    %eax,(%esp)
c0108450:	e8 61 b2 ff ff       	call   c01036b6 <free_pages>
    free_page(p2);
c0108455:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010845c:	00 
c010845d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108460:	89 04 24             	mov    %eax,(%esp)
c0108463:	e8 4e b2 ff ff       	call   c01036b6 <free_pages>

    assert((p0 = alloc_pages(5)) != NULL);
c0108468:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c010846f:	e8 d3 b1 ff ff       	call   c0103647 <alloc_pages>
c0108474:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108477:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010847b:	75 24                	jne    c01084a1 <default_check+0x533>
c010847d:	c7 44 24 0c 6c be 10 	movl   $0xc010be6c,0xc(%esp)
c0108484:	c0 
c0108485:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c010848c:	c0 
c010848d:	c7 44 24 04 23 01 00 	movl   $0x123,0x4(%esp)
c0108494:	00 
c0108495:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c010849c:	e8 9c 7f ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c01084a1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01084a8:	e8 9a b1 ff ff       	call   c0103647 <alloc_pages>
c01084ad:	85 c0                	test   %eax,%eax
c01084af:	74 24                	je     c01084d5 <default_check+0x567>
c01084b1:	c7 44 24 0c ca bc 10 	movl   $0xc010bcca,0xc(%esp)
c01084b8:	c0 
c01084b9:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01084c0:	c0 
c01084c1:	c7 44 24 04 24 01 00 	movl   $0x124,0x4(%esp)
c01084c8:	00 
c01084c9:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01084d0:	e8 68 7f ff ff       	call   c010043d <__panic>

    assert(nr_free == 0);
c01084d5:	a1 4c e1 12 c0       	mov    0xc012e14c,%eax
c01084da:	85 c0                	test   %eax,%eax
c01084dc:	74 24                	je     c0108502 <default_check+0x594>
c01084de:	c7 44 24 0c 1d bd 10 	movl   $0xc010bd1d,0xc(%esp)
c01084e5:	c0 
c01084e6:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01084ed:	c0 
c01084ee:	c7 44 24 04 26 01 00 	movl   $0x126,0x4(%esp)
c01084f5:	00 
c01084f6:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01084fd:	e8 3b 7f ff ff       	call   c010043d <__panic>
    nr_free = nr_free_store;
c0108502:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108505:	a3 4c e1 12 c0       	mov    %eax,0xc012e14c

    free_list = free_list_store;
c010850a:	8b 45 80             	mov    -0x80(%ebp),%eax
c010850d:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0108510:	a3 44 e1 12 c0       	mov    %eax,0xc012e144
c0108515:	89 15 48 e1 12 c0    	mov    %edx,0xc012e148
    free_pages(p0, 5);
c010851b:	c7 44 24 04 05 00 00 	movl   $0x5,0x4(%esp)
c0108522:	00 
c0108523:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108526:	89 04 24             	mov    %eax,(%esp)
c0108529:	e8 88 b1 ff ff       	call   c01036b6 <free_pages>

    le = &free_list;
c010852e:	c7 45 ec 44 e1 12 c0 	movl   $0xc012e144,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c0108535:	eb 1c                	jmp    c0108553 <default_check+0x5e5>
        struct Page *p = le2page(le, page_link);
c0108537:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010853a:	83 e8 0c             	sub    $0xc,%eax
c010853d:	89 45 d8             	mov    %eax,-0x28(%ebp)
        count --, total -= p->property;
c0108540:	ff 4d f4             	decl   -0xc(%ebp)
c0108543:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108546:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108549:	8b 40 08             	mov    0x8(%eax),%eax
c010854c:	29 c2                	sub    %eax,%edx
c010854e:	89 d0                	mov    %edx,%eax
c0108550:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108553:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108556:	89 45 88             	mov    %eax,-0x78(%ebp)
    return listelm->next;
c0108559:	8b 45 88             	mov    -0x78(%ebp),%eax
c010855c:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c010855f:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0108562:	81 7d ec 44 e1 12 c0 	cmpl   $0xc012e144,-0x14(%ebp)
c0108569:	75 cc                	jne    c0108537 <default_check+0x5c9>
    }
    assert(count == 0);
c010856b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010856f:	74 24                	je     c0108595 <default_check+0x627>
c0108571:	c7 44 24 0c 8a be 10 	movl   $0xc010be8a,0xc(%esp)
c0108578:	c0 
c0108579:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c0108580:	c0 
c0108581:	c7 44 24 04 31 01 00 	movl   $0x131,0x4(%esp)
c0108588:	00 
c0108589:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c0108590:	e8 a8 7e ff ff       	call   c010043d <__panic>
    assert(total == 0);
c0108595:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108599:	74 24                	je     c01085bf <default_check+0x651>
c010859b:	c7 44 24 0c 95 be 10 	movl   $0xc010be95,0xc(%esp)
c01085a2:	c0 
c01085a3:	c7 44 24 08 42 bb 10 	movl   $0xc010bb42,0x8(%esp)
c01085aa:	c0 
c01085ab:	c7 44 24 04 32 01 00 	movl   $0x132,0x4(%esp)
c01085b2:	00 
c01085b3:	c7 04 24 57 bb 10 c0 	movl   $0xc010bb57,(%esp)
c01085ba:	e8 7e 7e ff ff       	call   c010043d <__panic>
}
c01085bf:	90                   	nop
c01085c0:	c9                   	leave  
c01085c1:	c3                   	ret    

c01085c2 <page2ppn>:
page2ppn(struct Page *page) {
c01085c2:	55                   	push   %ebp
c01085c3:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01085c5:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c01085ca:	8b 55 08             	mov    0x8(%ebp),%edx
c01085cd:	29 c2                	sub    %eax,%edx
c01085cf:	89 d0                	mov    %edx,%eax
c01085d1:	c1 f8 05             	sar    $0x5,%eax
}
c01085d4:	5d                   	pop    %ebp
c01085d5:	c3                   	ret    

c01085d6 <page2pa>:
page2pa(struct Page *page) {
c01085d6:	55                   	push   %ebp
c01085d7:	89 e5                	mov    %esp,%ebp
c01085d9:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01085dc:	8b 45 08             	mov    0x8(%ebp),%eax
c01085df:	89 04 24             	mov    %eax,(%esp)
c01085e2:	e8 db ff ff ff       	call   c01085c2 <page2ppn>
c01085e7:	c1 e0 0c             	shl    $0xc,%eax
}
c01085ea:	c9                   	leave  
c01085eb:	c3                   	ret    

c01085ec <page2kva>:
page2kva(struct Page *page) {
c01085ec:	55                   	push   %ebp
c01085ed:	89 e5                	mov    %esp,%ebp
c01085ef:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01085f2:	8b 45 08             	mov    0x8(%ebp),%eax
c01085f5:	89 04 24             	mov    %eax,(%esp)
c01085f8:	e8 d9 ff ff ff       	call   c01085d6 <page2pa>
c01085fd:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108600:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108603:	c1 e8 0c             	shr    $0xc,%eax
c0108606:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108609:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c010860e:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0108611:	72 23                	jb     c0108636 <page2kva+0x4a>
c0108613:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108616:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010861a:	c7 44 24 08 d0 be 10 	movl   $0xc010bed0,0x8(%esp)
c0108621:	c0 
c0108622:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0108629:	00 
c010862a:	c7 04 24 f3 be 10 c0 	movl   $0xc010bef3,(%esp)
c0108631:	e8 07 7e ff ff       	call   c010043d <__panic>
c0108636:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108639:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c010863e:	c9                   	leave  
c010863f:	c3                   	ret    

c0108640 <swapfs_init>:
#include <ide.h>
#include <pmm.h>
#include <assert.h>

void
swapfs_init(void) {
c0108640:	f3 0f 1e fb          	endbr32 
c0108644:	55                   	push   %ebp
c0108645:	89 e5                	mov    %esp,%ebp
c0108647:	83 ec 18             	sub    $0x18,%esp
    static_assert((PGSIZE % SECTSIZE) == 0);
    if (!ide_device_valid(SWAP_DEV_NO)) {
c010864a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108651:	e8 17 8b ff ff       	call   c010116d <ide_device_valid>
c0108656:	85 c0                	test   %eax,%eax
c0108658:	75 1c                	jne    c0108676 <swapfs_init+0x36>
        panic("swap fs isn't available.\n");
c010865a:	c7 44 24 08 01 bf 10 	movl   $0xc010bf01,0x8(%esp)
c0108661:	c0 
c0108662:	c7 44 24 04 0d 00 00 	movl   $0xd,0x4(%esp)
c0108669:	00 
c010866a:	c7 04 24 1b bf 10 c0 	movl   $0xc010bf1b,(%esp)
c0108671:	e8 c7 7d ff ff       	call   c010043d <__panic>
    }
    max_swap_offset = ide_device_size(SWAP_DEV_NO) / (PGSIZE / SECTSIZE);
c0108676:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010867d:	e8 2d 8b ff ff       	call   c01011af <ide_device_size>
c0108682:	c1 e8 03             	shr    $0x3,%eax
c0108685:	a3 1c e1 12 c0       	mov    %eax,0xc012e11c
}
c010868a:	90                   	nop
c010868b:	c9                   	leave  
c010868c:	c3                   	ret    

c010868d <swapfs_read>:

int
swapfs_read(swap_entry_t entry, struct Page *page) {
c010868d:	f3 0f 1e fb          	endbr32 
c0108691:	55                   	push   %ebp
c0108692:	89 e5                	mov    %esp,%ebp
c0108694:	83 ec 28             	sub    $0x28,%esp
    return ide_read_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c0108697:	8b 45 0c             	mov    0xc(%ebp),%eax
c010869a:	89 04 24             	mov    %eax,(%esp)
c010869d:	e8 4a ff ff ff       	call   c01085ec <page2kva>
c01086a2:	8b 55 08             	mov    0x8(%ebp),%edx
c01086a5:	c1 ea 08             	shr    $0x8,%edx
c01086a8:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01086ab:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01086af:	74 0b                	je     c01086bc <swapfs_read+0x2f>
c01086b1:	8b 15 1c e1 12 c0    	mov    0xc012e11c,%edx
c01086b7:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c01086ba:	72 23                	jb     c01086df <swapfs_read+0x52>
c01086bc:	8b 45 08             	mov    0x8(%ebp),%eax
c01086bf:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01086c3:	c7 44 24 08 2c bf 10 	movl   $0xc010bf2c,0x8(%esp)
c01086ca:	c0 
c01086cb:	c7 44 24 04 14 00 00 	movl   $0x14,0x4(%esp)
c01086d2:	00 
c01086d3:	c7 04 24 1b bf 10 c0 	movl   $0xc010bf1b,(%esp)
c01086da:	e8 5e 7d ff ff       	call   c010043d <__panic>
c01086df:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01086e2:	c1 e2 03             	shl    $0x3,%edx
c01086e5:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c01086ec:	00 
c01086ed:	89 44 24 08          	mov    %eax,0x8(%esp)
c01086f1:	89 54 24 04          	mov    %edx,0x4(%esp)
c01086f5:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01086fc:	e8 ed 8a ff ff       	call   c01011ee <ide_read_secs>
}
c0108701:	c9                   	leave  
c0108702:	c3                   	ret    

c0108703 <swapfs_write>:

int
swapfs_write(swap_entry_t entry, struct Page *page) {
c0108703:	f3 0f 1e fb          	endbr32 
c0108707:	55                   	push   %ebp
c0108708:	89 e5                	mov    %esp,%ebp
c010870a:	83 ec 28             	sub    $0x28,%esp
    return ide_write_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c010870d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108710:	89 04 24             	mov    %eax,(%esp)
c0108713:	e8 d4 fe ff ff       	call   c01085ec <page2kva>
c0108718:	8b 55 08             	mov    0x8(%ebp),%edx
c010871b:	c1 ea 08             	shr    $0x8,%edx
c010871e:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0108721:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108725:	74 0b                	je     c0108732 <swapfs_write+0x2f>
c0108727:	8b 15 1c e1 12 c0    	mov    0xc012e11c,%edx
c010872d:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c0108730:	72 23                	jb     c0108755 <swapfs_write+0x52>
c0108732:	8b 45 08             	mov    0x8(%ebp),%eax
c0108735:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108739:	c7 44 24 08 2c bf 10 	movl   $0xc010bf2c,0x8(%esp)
c0108740:	c0 
c0108741:	c7 44 24 04 19 00 00 	movl   $0x19,0x4(%esp)
c0108748:	00 
c0108749:	c7 04 24 1b bf 10 c0 	movl   $0xc010bf1b,(%esp)
c0108750:	e8 e8 7c ff ff       	call   c010043d <__panic>
c0108755:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108758:	c1 e2 03             	shl    $0x3,%edx
c010875b:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c0108762:	00 
c0108763:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108767:	89 54 24 04          	mov    %edx,0x4(%esp)
c010876b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108772:	e8 bc 8c ff ff       	call   c0101433 <ide_write_secs>
}
c0108777:	c9                   	leave  
c0108778:	c3                   	ret    

c0108779 <switch_to>:
.text
.globl switch_to
switch_to:                      # switch_to(from, to)

    # save from's registers
    movl 4(%esp), %eax          # eax points to from
c0108779:	8b 44 24 04          	mov    0x4(%esp),%eax
    popl 0(%eax)                # save eip !popl
c010877d:	8f 00                	popl   (%eax)
    movl %esp, 4(%eax)          # save esp::context of from
c010877f:	89 60 04             	mov    %esp,0x4(%eax)
    movl %ebx, 8(%eax)          # save ebx::context of from
c0108782:	89 58 08             	mov    %ebx,0x8(%eax)
    movl %ecx, 12(%eax)         # save ecx::context of from
c0108785:	89 48 0c             	mov    %ecx,0xc(%eax)
    movl %edx, 16(%eax)         # save edx::context of from
c0108788:	89 50 10             	mov    %edx,0x10(%eax)
    movl %esi, 20(%eax)         # save esi::context of from
c010878b:	89 70 14             	mov    %esi,0x14(%eax)
    movl %edi, 24(%eax)         # save edi::context of from
c010878e:	89 78 18             	mov    %edi,0x18(%eax)
    movl %ebp, 28(%eax)         # save ebp::context of from
c0108791:	89 68 1c             	mov    %ebp,0x1c(%eax)

    # restore to's registers
    movl 4(%esp), %eax          # not 8(%esp): popped return address already
c0108794:	8b 44 24 04          	mov    0x4(%esp),%eax
                                # eax now points to to
    movl 28(%eax), %ebp         # restore ebp::context of to
c0108798:	8b 68 1c             	mov    0x1c(%eax),%ebp
    movl 24(%eax), %edi         # restore edi::context of to
c010879b:	8b 78 18             	mov    0x18(%eax),%edi
    movl 20(%eax), %esi         # restore esi::context of to
c010879e:	8b 70 14             	mov    0x14(%eax),%esi
    movl 16(%eax), %edx         # restore edx::context of to
c01087a1:	8b 50 10             	mov    0x10(%eax),%edx
    movl 12(%eax), %ecx         # restore ecx::context of to
c01087a4:	8b 48 0c             	mov    0xc(%eax),%ecx
    movl 8(%eax), %ebx          # restore ebx::context of to
c01087a7:	8b 58 08             	mov    0x8(%eax),%ebx
    movl 4(%eax), %esp          # restore esp::context of to
c01087aa:	8b 60 04             	mov    0x4(%eax),%esp

    pushl 0(%eax)               # push eip
c01087ad:	ff 30                	pushl  (%eax)

    ret
c01087af:	c3                   	ret    

c01087b0 <kernel_thread_entry>:
.text
.globl kernel_thread_entry
kernel_thread_entry:        # void kernel_thread(void)

    pushl %edx              # push arg
c01087b0:	52                   	push   %edx
    call *%ebx              # call fn
c01087b1:	ff d3                	call   *%ebx

    pushl %eax              # save the return value of fn(arg)
c01087b3:	50                   	push   %eax
    call do_exit            # call do_exit to terminate current thread
c01087b4:	e8 85 08 00 00       	call   c010903e <do_exit>

c01087b9 <__intr_save>:
__intr_save(void) {
c01087b9:	55                   	push   %ebp
c01087ba:	89 e5                	mov    %esp,%ebp
c01087bc:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01087bf:	9c                   	pushf  
c01087c0:	58                   	pop    %eax
c01087c1:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c01087c4:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c01087c7:	25 00 02 00 00       	and    $0x200,%eax
c01087cc:	85 c0                	test   %eax,%eax
c01087ce:	74 0c                	je     c01087dc <__intr_save+0x23>
        intr_disable();
c01087d0:	e8 2f 9a ff ff       	call   c0102204 <intr_disable>
        return 1;
c01087d5:	b8 01 00 00 00       	mov    $0x1,%eax
c01087da:	eb 05                	jmp    c01087e1 <__intr_save+0x28>
    return 0;
c01087dc:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01087e1:	c9                   	leave  
c01087e2:	c3                   	ret    

c01087e3 <__intr_restore>:
__intr_restore(bool flag) {
c01087e3:	55                   	push   %ebp
c01087e4:	89 e5                	mov    %esp,%ebp
c01087e6:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c01087e9:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01087ed:	74 05                	je     c01087f4 <__intr_restore+0x11>
        intr_enable();
c01087ef:	e8 04 9a ff ff       	call   c01021f8 <intr_enable>
}
c01087f4:	90                   	nop
c01087f5:	c9                   	leave  
c01087f6:	c3                   	ret    

c01087f7 <page2ppn>:
page2ppn(struct Page *page) {
c01087f7:	55                   	push   %ebp
c01087f8:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01087fa:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c01087ff:	8b 55 08             	mov    0x8(%ebp),%edx
c0108802:	29 c2                	sub    %eax,%edx
c0108804:	89 d0                	mov    %edx,%eax
c0108806:	c1 f8 05             	sar    $0x5,%eax
}
c0108809:	5d                   	pop    %ebp
c010880a:	c3                   	ret    

c010880b <page2pa>:
page2pa(struct Page *page) {
c010880b:	55                   	push   %ebp
c010880c:	89 e5                	mov    %esp,%ebp
c010880e:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0108811:	8b 45 08             	mov    0x8(%ebp),%eax
c0108814:	89 04 24             	mov    %eax,(%esp)
c0108817:	e8 db ff ff ff       	call   c01087f7 <page2ppn>
c010881c:	c1 e0 0c             	shl    $0xc,%eax
}
c010881f:	c9                   	leave  
c0108820:	c3                   	ret    

c0108821 <pa2page>:
pa2page(uintptr_t pa) {
c0108821:	55                   	push   %ebp
c0108822:	89 e5                	mov    %esp,%ebp
c0108824:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0108827:	8b 45 08             	mov    0x8(%ebp),%eax
c010882a:	c1 e8 0c             	shr    $0xc,%eax
c010882d:	89 c2                	mov    %eax,%edx
c010882f:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0108834:	39 c2                	cmp    %eax,%edx
c0108836:	72 1c                	jb     c0108854 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0108838:	c7 44 24 08 4c bf 10 	movl   $0xc010bf4c,0x8(%esp)
c010883f:	c0 
c0108840:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0108847:	00 
c0108848:	c7 04 24 6b bf 10 c0 	movl   $0xc010bf6b,(%esp)
c010884f:	e8 e9 7b ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0108854:	a1 60 e0 12 c0       	mov    0xc012e060,%eax
c0108859:	8b 55 08             	mov    0x8(%ebp),%edx
c010885c:	c1 ea 0c             	shr    $0xc,%edx
c010885f:	c1 e2 05             	shl    $0x5,%edx
c0108862:	01 d0                	add    %edx,%eax
}
c0108864:	c9                   	leave  
c0108865:	c3                   	ret    

c0108866 <page2kva>:
page2kva(struct Page *page) {
c0108866:	55                   	push   %ebp
c0108867:	89 e5                	mov    %esp,%ebp
c0108869:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c010886c:	8b 45 08             	mov    0x8(%ebp),%eax
c010886f:	89 04 24             	mov    %eax,(%esp)
c0108872:	e8 94 ff ff ff       	call   c010880b <page2pa>
c0108877:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010887a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010887d:	c1 e8 0c             	shr    $0xc,%eax
c0108880:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108883:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0108888:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c010888b:	72 23                	jb     c01088b0 <page2kva+0x4a>
c010888d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108890:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108894:	c7 44 24 08 7c bf 10 	movl   $0xc010bf7c,0x8(%esp)
c010889b:	c0 
c010889c:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c01088a3:	00 
c01088a4:	c7 04 24 6b bf 10 c0 	movl   $0xc010bf6b,(%esp)
c01088ab:	e8 8d 7b ff ff       	call   c010043d <__panic>
c01088b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01088b3:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c01088b8:	c9                   	leave  
c01088b9:	c3                   	ret    

c01088ba <kva2page>:
kva2page(void *kva) {
c01088ba:	55                   	push   %ebp
c01088bb:	89 e5                	mov    %esp,%ebp
c01088bd:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c01088c0:	8b 45 08             	mov    0x8(%ebp),%eax
c01088c3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01088c6:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c01088cd:	77 23                	ja     c01088f2 <kva2page+0x38>
c01088cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01088d2:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01088d6:	c7 44 24 08 a0 bf 10 	movl   $0xc010bfa0,0x8(%esp)
c01088dd:	c0 
c01088de:	c7 44 24 04 6b 00 00 	movl   $0x6b,0x4(%esp)
c01088e5:	00 
c01088e6:	c7 04 24 6b bf 10 c0 	movl   $0xc010bf6b,(%esp)
c01088ed:	e8 4b 7b ff ff       	call   c010043d <__panic>
c01088f2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01088f5:	05 00 00 00 40       	add    $0x40000000,%eax
c01088fa:	89 04 24             	mov    %eax,(%esp)
c01088fd:	e8 1f ff ff ff       	call   c0108821 <pa2page>
}
c0108902:	c9                   	leave  
c0108903:	c3                   	ret    

c0108904 <alloc_proc>:
void forkrets(struct trapframe *tf);
void switch_to(struct context *from, struct context *to);

// alloc_proc - alloc a proc_struct and init all fields of proc_struct
static struct proc_struct *
alloc_proc(void) {
c0108904:	f3 0f 1e fb          	endbr32 
c0108908:	55                   	push   %ebp
c0108909:	89 e5                	mov    %esp,%ebp
c010890b:	83 ec 28             	sub    $0x28,%esp
    struct proc_struct *proc = kmalloc(sizeof(struct proc_struct));
c010890e:	c7 04 24 68 00 00 00 	movl   $0x68,(%esp)
c0108915:	e8 43 dd ff ff       	call   c010665d <kmalloc>
c010891a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (proc != NULL) {
c010891d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108921:	0f 84 a1 00 00 00    	je     c01089c8 <alloc_proc+0xc4>
    //LAB4:EXERCISE1 YOUR CODE
   	proc->state=PROC_UNINIT;                      // Process state 
c0108927:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010892a:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        proc->pid=-1;                                    // Process's ID
c0108930:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108933:	c7 40 04 ff ff ff ff 	movl   $0xffffffff,0x4(%eax)
        proc->runs=0;                                   // the running times of Proces
c010893a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010893d:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        proc->kstack=0;                           // Process kernel stack
c0108944:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108947:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        proc->need_resched=0;                 // bool value: need to be rescheduled to release CPU?
c010894e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108951:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        proc->parent=NULL;                 // the parent process
c0108958:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010895b:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
        proc->mm=NULL;                       // Process's memory management field
c0108962:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108965:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
        memset(&(proc->context),0,sizeof(struct context));                     // Switch here to run process
c010896c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010896f:	83 c0 1c             	add    $0x1c,%eax
c0108972:	c7 44 24 08 20 00 00 	movl   $0x20,0x8(%esp)
c0108979:	00 
c010897a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108981:	00 
c0108982:	89 04 24             	mov    %eax,(%esp)
c0108985:	e8 ae 0d 00 00       	call   c0109738 <memset>
        proc->tf=NULL;                       // Trap frame for current interrupt
c010898a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010898d:	c7 40 3c 00 00 00 00 	movl   $0x0,0x3c(%eax)
        proc->cr3=boot_cr3;                              // CR3 register: the base addr of Page Directroy Table(PDT)
c0108994:	8b 15 5c e0 12 c0    	mov    0xc012e05c,%edx
c010899a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010899d:	89 50 40             	mov    %edx,0x40(%eax)
        proc->flags=0;                             // Process flag
c01089a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01089a3:	c7 40 44 00 00 00 00 	movl   $0x0,0x44(%eax)
        memset(proc->name,0,PROC_NAME_LEN);               // Process name
c01089aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01089ad:	83 c0 48             	add    $0x48,%eax
c01089b0:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c01089b7:	00 
c01089b8:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01089bf:	00 
c01089c0:	89 04 24             	mov    %eax,(%esp)
c01089c3:	e8 70 0d 00 00       	call   c0109738 <memset>
    }
    return proc;
c01089c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01089cb:	c9                   	leave  
c01089cc:	c3                   	ret    

c01089cd <set_proc_name>:

// set_proc_name - set the name of proc
char *
set_proc_name(struct proc_struct *proc, const char *name) {
c01089cd:	f3 0f 1e fb          	endbr32 
c01089d1:	55                   	push   %ebp
c01089d2:	89 e5                	mov    %esp,%ebp
c01089d4:	83 ec 18             	sub    $0x18,%esp
    memset(proc->name, 0, sizeof(proc->name));
c01089d7:	8b 45 08             	mov    0x8(%ebp),%eax
c01089da:	83 c0 48             	add    $0x48,%eax
c01089dd:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c01089e4:	00 
c01089e5:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01089ec:	00 
c01089ed:	89 04 24             	mov    %eax,(%esp)
c01089f0:	e8 43 0d 00 00       	call   c0109738 <memset>
    return memcpy(proc->name, name, PROC_NAME_LEN);
c01089f5:	8b 45 08             	mov    0x8(%ebp),%eax
c01089f8:	8d 50 48             	lea    0x48(%eax),%edx
c01089fb:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c0108a02:	00 
c0108a03:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108a06:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108a0a:	89 14 24             	mov    %edx,(%esp)
c0108a0d:	e8 10 0e 00 00       	call   c0109822 <memcpy>
}
c0108a12:	c9                   	leave  
c0108a13:	c3                   	ret    

c0108a14 <get_proc_name>:

// get_proc_name - get the name of proc
char *
get_proc_name(struct proc_struct *proc) {
c0108a14:	f3 0f 1e fb          	endbr32 
c0108a18:	55                   	push   %ebp
c0108a19:	89 e5                	mov    %esp,%ebp
c0108a1b:	83 ec 18             	sub    $0x18,%esp
    static char name[PROC_NAME_LEN + 1];
    memset(name, 0, sizeof(name));
c0108a1e:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c0108a25:	00 
c0108a26:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108a2d:	00 
c0108a2e:	c7 04 24 44 e0 12 c0 	movl   $0xc012e044,(%esp)
c0108a35:	e8 fe 0c 00 00       	call   c0109738 <memset>
    return memcpy(name, proc->name, PROC_NAME_LEN);
c0108a3a:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a3d:	83 c0 48             	add    $0x48,%eax
c0108a40:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c0108a47:	00 
c0108a48:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108a4c:	c7 04 24 44 e0 12 c0 	movl   $0xc012e044,(%esp)
c0108a53:	e8 ca 0d 00 00       	call   c0109822 <memcpy>
}
c0108a58:	c9                   	leave  
c0108a59:	c3                   	ret    

c0108a5a <get_pid>:

// get_pid - alloc a unique pid for process
static int
get_pid(void) {
c0108a5a:	f3 0f 1e fb          	endbr32 
c0108a5e:	55                   	push   %ebp
c0108a5f:	89 e5                	mov    %esp,%ebp
c0108a61:	83 ec 10             	sub    $0x10,%esp
    static_assert(MAX_PID > MAX_PROCESS);
    struct proc_struct *proc;
    list_entry_t *list = &proc_list, *le;
c0108a64:	c7 45 f8 50 e1 12 c0 	movl   $0xc012e150,-0x8(%ebp)
    static int next_safe = MAX_PID, last_pid = MAX_PID;
    if (++ last_pid >= MAX_PID) {
c0108a6b:	a1 6c 8a 12 c0       	mov    0xc0128a6c,%eax
c0108a70:	40                   	inc    %eax
c0108a71:	a3 6c 8a 12 c0       	mov    %eax,0xc0128a6c
c0108a76:	a1 6c 8a 12 c0       	mov    0xc0128a6c,%eax
c0108a7b:	3d ff 1f 00 00       	cmp    $0x1fff,%eax
c0108a80:	7e 0c                	jle    c0108a8e <get_pid+0x34>
        last_pid = 1;
c0108a82:	c7 05 6c 8a 12 c0 01 	movl   $0x1,0xc0128a6c
c0108a89:	00 00 00 
        goto inside;
c0108a8c:	eb 14                	jmp    c0108aa2 <get_pid+0x48>
    }
    if (last_pid >= next_safe) {
c0108a8e:	8b 15 6c 8a 12 c0    	mov    0xc0128a6c,%edx
c0108a94:	a1 70 8a 12 c0       	mov    0xc0128a70,%eax
c0108a99:	39 c2                	cmp    %eax,%edx
c0108a9b:	0f 8c ab 00 00 00    	jl     c0108b4c <get_pid+0xf2>
    inside:
c0108aa1:	90                   	nop
        next_safe = MAX_PID;
c0108aa2:	c7 05 70 8a 12 c0 00 	movl   $0x2000,0xc0128a70
c0108aa9:	20 00 00 
    repeat:
        le = list;
c0108aac:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0108aaf:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while ((le = list_next(le)) != list) {
c0108ab2:	eb 7d                	jmp    c0108b31 <get_pid+0xd7>
            proc = le2proc(le, list_link);
c0108ab4:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108ab7:	83 e8 58             	sub    $0x58,%eax
c0108aba:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (proc->pid == last_pid) {
c0108abd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108ac0:	8b 50 04             	mov    0x4(%eax),%edx
c0108ac3:	a1 6c 8a 12 c0       	mov    0xc0128a6c,%eax
c0108ac8:	39 c2                	cmp    %eax,%edx
c0108aca:	75 3c                	jne    c0108b08 <get_pid+0xae>
                if (++ last_pid >= next_safe) {
c0108acc:	a1 6c 8a 12 c0       	mov    0xc0128a6c,%eax
c0108ad1:	40                   	inc    %eax
c0108ad2:	a3 6c 8a 12 c0       	mov    %eax,0xc0128a6c
c0108ad7:	8b 15 6c 8a 12 c0    	mov    0xc0128a6c,%edx
c0108add:	a1 70 8a 12 c0       	mov    0xc0128a70,%eax
c0108ae2:	39 c2                	cmp    %eax,%edx
c0108ae4:	7c 4b                	jl     c0108b31 <get_pid+0xd7>
                    if (last_pid >= MAX_PID) {
c0108ae6:	a1 6c 8a 12 c0       	mov    0xc0128a6c,%eax
c0108aeb:	3d ff 1f 00 00       	cmp    $0x1fff,%eax
c0108af0:	7e 0a                	jle    c0108afc <get_pid+0xa2>
                        last_pid = 1;
c0108af2:	c7 05 6c 8a 12 c0 01 	movl   $0x1,0xc0128a6c
c0108af9:	00 00 00 
                    }
                    next_safe = MAX_PID;
c0108afc:	c7 05 70 8a 12 c0 00 	movl   $0x2000,0xc0128a70
c0108b03:	20 00 00 
                    goto repeat;
c0108b06:	eb a4                	jmp    c0108aac <get_pid+0x52>
                }
            }
            else if (proc->pid > last_pid && next_safe > proc->pid) {
c0108b08:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108b0b:	8b 50 04             	mov    0x4(%eax),%edx
c0108b0e:	a1 6c 8a 12 c0       	mov    0xc0128a6c,%eax
c0108b13:	39 c2                	cmp    %eax,%edx
c0108b15:	7e 1a                	jle    c0108b31 <get_pid+0xd7>
c0108b17:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108b1a:	8b 50 04             	mov    0x4(%eax),%edx
c0108b1d:	a1 70 8a 12 c0       	mov    0xc0128a70,%eax
c0108b22:	39 c2                	cmp    %eax,%edx
c0108b24:	7d 0b                	jge    c0108b31 <get_pid+0xd7>
                next_safe = proc->pid;
c0108b26:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108b29:	8b 40 04             	mov    0x4(%eax),%eax
c0108b2c:	a3 70 8a 12 c0       	mov    %eax,0xc0128a70
c0108b31:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108b34:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108b37:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b3a:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c0108b3d:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0108b40:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108b43:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c0108b46:	0f 85 68 ff ff ff    	jne    c0108ab4 <get_pid+0x5a>
            }
        }
    }
    return last_pid;
c0108b4c:	a1 6c 8a 12 c0       	mov    0xc0128a6c,%eax
}
c0108b51:	c9                   	leave  
c0108b52:	c3                   	ret    

c0108b53 <proc_run>:

// proc_run - make process "proc" running on cpu
// NOTE: before call switch_to, should load  base addr of "proc"'s new PDT
void
proc_run(struct proc_struct *proc) {
c0108b53:	f3 0f 1e fb          	endbr32 
c0108b57:	55                   	push   %ebp
c0108b58:	89 e5                	mov    %esp,%ebp
c0108b5a:	83 ec 28             	sub    $0x28,%esp
    if (proc != current) {
c0108b5d:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0108b62:	39 45 08             	cmp    %eax,0x8(%ebp)
c0108b65:	74 64                	je     c0108bcb <proc_run+0x78>
        bool intr_flag;
        struct proc_struct *prev = current, *next = proc;
c0108b67:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0108b6c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108b6f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108b72:	89 45 f0             	mov    %eax,-0x10(%ebp)
        local_intr_save(intr_flag);
c0108b75:	e8 3f fc ff ff       	call   c01087b9 <__intr_save>
c0108b7a:	89 45 ec             	mov    %eax,-0x14(%ebp)
        {
            current = proc;
c0108b7d:	8b 45 08             	mov    0x8(%ebp),%eax
c0108b80:	a3 28 c0 12 c0       	mov    %eax,0xc012c028
            load_esp0(next->kstack + KSTACKSIZE);
c0108b85:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b88:	8b 40 0c             	mov    0xc(%eax),%eax
c0108b8b:	05 00 20 00 00       	add    $0x2000,%eax
c0108b90:	89 04 24             	mov    %eax,(%esp)
c0108b93:	e8 53 a9 ff ff       	call   c01034eb <load_esp0>
            lcr3(next->cr3);
c0108b98:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b9b:	8b 40 40             	mov    0x40(%eax),%eax
c0108b9e:	89 45 e8             	mov    %eax,-0x18(%ebp)
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c0108ba1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108ba4:	0f 22 d8             	mov    %eax,%cr3
}
c0108ba7:	90                   	nop
            switch_to(&(prev->context), &(next->context));
c0108ba8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108bab:	8d 50 1c             	lea    0x1c(%eax),%edx
c0108bae:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108bb1:	83 c0 1c             	add    $0x1c,%eax
c0108bb4:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108bb8:	89 04 24             	mov    %eax,(%esp)
c0108bbb:	e8 b9 fb ff ff       	call   c0108779 <switch_to>
        }
        local_intr_restore(intr_flag);
c0108bc0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108bc3:	89 04 24             	mov    %eax,(%esp)
c0108bc6:	e8 18 fc ff ff       	call   c01087e3 <__intr_restore>
    }
}
c0108bcb:	90                   	nop
c0108bcc:	c9                   	leave  
c0108bcd:	c3                   	ret    

c0108bce <forkret>:

// forkret -- the first kernel entry point of a new thread/process
// NOTE: the addr of forkret is setted in copy_thread function
//       after switch_to, the current proc will execute here.
static void
forkret(void) {
c0108bce:	f3 0f 1e fb          	endbr32 
c0108bd2:	55                   	push   %ebp
c0108bd3:	89 e5                	mov    %esp,%ebp
c0108bd5:	83 ec 18             	sub    $0x18,%esp
    forkrets(current->tf);
c0108bd8:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0108bdd:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108be0:	89 04 24             	mov    %eax,(%esp)
c0108be3:	e8 2a a7 ff ff       	call   c0103312 <forkrets>
}
c0108be8:	90                   	nop
c0108be9:	c9                   	leave  
c0108bea:	c3                   	ret    

c0108beb <hash_proc>:

// hash_proc - add proc into proc hash_list
static void
hash_proc(struct proc_struct *proc) {
c0108beb:	f3 0f 1e fb          	endbr32 
c0108bef:	55                   	push   %ebp
c0108bf0:	89 e5                	mov    %esp,%ebp
c0108bf2:	53                   	push   %ebx
c0108bf3:	83 ec 34             	sub    $0x34,%esp
    list_add(hash_list + pid_hashfn(proc->pid), &(proc->hash_link));
c0108bf6:	8b 45 08             	mov    0x8(%ebp),%eax
c0108bf9:	8d 58 60             	lea    0x60(%eax),%ebx
c0108bfc:	8b 45 08             	mov    0x8(%ebp),%eax
c0108bff:	8b 40 04             	mov    0x4(%eax),%eax
c0108c02:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
c0108c09:	00 
c0108c0a:	89 04 24             	mov    %eax,(%esp)
c0108c0d:	e8 4a 13 00 00       	call   c0109f5c <hash32>
c0108c12:	c1 e0 03             	shl    $0x3,%eax
c0108c15:	05 40 c0 12 c0       	add    $0xc012c040,%eax
c0108c1a:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108c1d:	89 5d f0             	mov    %ebx,-0x10(%ebp)
c0108c20:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108c23:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0108c26:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108c29:	89 45 e8             	mov    %eax,-0x18(%ebp)
    __list_add(elm, listelm, listelm->next);
c0108c2c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108c2f:	8b 40 04             	mov    0x4(%eax),%eax
c0108c32:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0108c35:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0108c38:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0108c3b:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0108c3e:	89 45 dc             	mov    %eax,-0x24(%ebp)
    prev->next = next->prev = elm;
c0108c41:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108c44:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0108c47:	89 10                	mov    %edx,(%eax)
c0108c49:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108c4c:	8b 10                	mov    (%eax),%edx
c0108c4e:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108c51:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0108c54:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108c57:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0108c5a:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0108c5d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108c60:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108c63:	89 10                	mov    %edx,(%eax)
}
c0108c65:	90                   	nop
}
c0108c66:	90                   	nop
}
c0108c67:	90                   	nop
}
c0108c68:	90                   	nop
c0108c69:	83 c4 34             	add    $0x34,%esp
c0108c6c:	5b                   	pop    %ebx
c0108c6d:	5d                   	pop    %ebp
c0108c6e:	c3                   	ret    

c0108c6f <find_proc>:

// find_proc - find proc frome proc hash_list according to pid
struct proc_struct *
find_proc(int pid) {
c0108c6f:	f3 0f 1e fb          	endbr32 
c0108c73:	55                   	push   %ebp
c0108c74:	89 e5                	mov    %esp,%ebp
c0108c76:	83 ec 28             	sub    $0x28,%esp
    if (0 < pid && pid < MAX_PID) {
c0108c79:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0108c7d:	7e 5f                	jle    c0108cde <find_proc+0x6f>
c0108c7f:	81 7d 08 ff 1f 00 00 	cmpl   $0x1fff,0x8(%ebp)
c0108c86:	7f 56                	jg     c0108cde <find_proc+0x6f>
        list_entry_t *list = hash_list + pid_hashfn(pid), *le = list;
c0108c88:	8b 45 08             	mov    0x8(%ebp),%eax
c0108c8b:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
c0108c92:	00 
c0108c93:	89 04 24             	mov    %eax,(%esp)
c0108c96:	e8 c1 12 00 00       	call   c0109f5c <hash32>
c0108c9b:	c1 e0 03             	shl    $0x3,%eax
c0108c9e:	05 40 c0 12 c0       	add    $0xc012c040,%eax
c0108ca3:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108ca6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108ca9:	89 45 f4             	mov    %eax,-0xc(%ebp)
        while ((le = list_next(le)) != list) {
c0108cac:	eb 19                	jmp    c0108cc7 <find_proc+0x58>
            struct proc_struct *proc = le2proc(le, hash_link);
c0108cae:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108cb1:	83 e8 60             	sub    $0x60,%eax
c0108cb4:	89 45 ec             	mov    %eax,-0x14(%ebp)
            if (proc->pid == pid) {
c0108cb7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108cba:	8b 40 04             	mov    0x4(%eax),%eax
c0108cbd:	39 45 08             	cmp    %eax,0x8(%ebp)
c0108cc0:	75 05                	jne    c0108cc7 <find_proc+0x58>
                return proc;
c0108cc2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108cc5:	eb 1c                	jmp    c0108ce3 <find_proc+0x74>
c0108cc7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108cca:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return listelm->next;
c0108ccd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108cd0:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c0108cd3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108cd6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108cd9:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0108cdc:	75 d0                	jne    c0108cae <find_proc+0x3f>
            }
        }
    }
    return NULL;
c0108cde:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108ce3:	c9                   	leave  
c0108ce4:	c3                   	ret    

c0108ce5 <kernel_thread>:

// kernel_thread - create a kernel thread using "fn" function
// NOTE: the contents of temp trapframe tf will be copied to 
//       proc->tf in do_fork-->copy_thread function
int
kernel_thread(int (*fn)(void *), void *arg, uint32_t clone_flags) {
c0108ce5:	f3 0f 1e fb          	endbr32 
c0108ce9:	55                   	push   %ebp
c0108cea:	89 e5                	mov    %esp,%ebp
c0108cec:	83 ec 68             	sub    $0x68,%esp
    struct trapframe tf;
    memset(&tf, 0, sizeof(struct trapframe));
c0108cef:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
c0108cf6:	00 
c0108cf7:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108cfe:	00 
c0108cff:	8d 45 ac             	lea    -0x54(%ebp),%eax
c0108d02:	89 04 24             	mov    %eax,(%esp)
c0108d05:	e8 2e 0a 00 00       	call   c0109738 <memset>
    tf.tf_cs = KERNEL_CS;
c0108d0a:	66 c7 45 e8 08 00    	movw   $0x8,-0x18(%ebp)
    tf.tf_ds = tf.tf_es = tf.tf_ss = KERNEL_DS;
c0108d10:	66 c7 45 f4 10 00    	movw   $0x10,-0xc(%ebp)
c0108d16:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c0108d1a:	66 89 45 d4          	mov    %ax,-0x2c(%ebp)
c0108d1e:	0f b7 45 d4          	movzwl -0x2c(%ebp),%eax
c0108d22:	66 89 45 d8          	mov    %ax,-0x28(%ebp)
    tf.tf_regs.reg_ebx = (uint32_t)fn;
c0108d26:	8b 45 08             	mov    0x8(%ebp),%eax
c0108d29:	89 45 bc             	mov    %eax,-0x44(%ebp)
    tf.tf_regs.reg_edx = (uint32_t)arg;
c0108d2c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108d2f:	89 45 c0             	mov    %eax,-0x40(%ebp)
    tf.tf_eip = (uint32_t)kernel_thread_entry;
c0108d32:	b8 b0 87 10 c0       	mov    $0xc01087b0,%eax
c0108d37:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return do_fork(clone_flags | CLONE_VM, 0, &tf);
c0108d3a:	8b 45 10             	mov    0x10(%ebp),%eax
c0108d3d:	0d 00 01 00 00       	or     $0x100,%eax
c0108d42:	89 c2                	mov    %eax,%edx
c0108d44:	8d 45 ac             	lea    -0x54(%ebp),%eax
c0108d47:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108d4b:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108d52:	00 
c0108d53:	89 14 24             	mov    %edx,(%esp)
c0108d56:	e8 98 01 00 00       	call   c0108ef3 <do_fork>
}
c0108d5b:	c9                   	leave  
c0108d5c:	c3                   	ret    

c0108d5d <setup_kstack>:

// setup_kstack - alloc pages with size KSTACKPAGE as process kernel stack
static int
setup_kstack(struct proc_struct *proc) {
c0108d5d:	f3 0f 1e fb          	endbr32 
c0108d61:	55                   	push   %ebp
c0108d62:	89 e5                	mov    %esp,%ebp
c0108d64:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_pages(KSTACKPAGE);
c0108d67:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c0108d6e:	e8 d4 a8 ff ff       	call   c0103647 <alloc_pages>
c0108d73:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c0108d76:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108d7a:	74 1a                	je     c0108d96 <setup_kstack+0x39>
        proc->kstack = (uintptr_t)page2kva(page);
c0108d7c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108d7f:	89 04 24             	mov    %eax,(%esp)
c0108d82:	e8 df fa ff ff       	call   c0108866 <page2kva>
c0108d87:	89 c2                	mov    %eax,%edx
c0108d89:	8b 45 08             	mov    0x8(%ebp),%eax
c0108d8c:	89 50 0c             	mov    %edx,0xc(%eax)
        return 0;
c0108d8f:	b8 00 00 00 00       	mov    $0x0,%eax
c0108d94:	eb 05                	jmp    c0108d9b <setup_kstack+0x3e>
    }
    return -E_NO_MEM;
c0108d96:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
}
c0108d9b:	c9                   	leave  
c0108d9c:	c3                   	ret    

c0108d9d <put_kstack>:

// put_kstack - free the memory space of process kernel stack
static void
put_kstack(struct proc_struct *proc) {
c0108d9d:	f3 0f 1e fb          	endbr32 
c0108da1:	55                   	push   %ebp
c0108da2:	89 e5                	mov    %esp,%ebp
c0108da4:	83 ec 18             	sub    $0x18,%esp
    free_pages(kva2page((void *)(proc->kstack)), KSTACKPAGE);
c0108da7:	8b 45 08             	mov    0x8(%ebp),%eax
c0108daa:	8b 40 0c             	mov    0xc(%eax),%eax
c0108dad:	89 04 24             	mov    %eax,(%esp)
c0108db0:	e8 05 fb ff ff       	call   c01088ba <kva2page>
c0108db5:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c0108dbc:	00 
c0108dbd:	89 04 24             	mov    %eax,(%esp)
c0108dc0:	e8 f1 a8 ff ff       	call   c01036b6 <free_pages>
}
c0108dc5:	90                   	nop
c0108dc6:	c9                   	leave  
c0108dc7:	c3                   	ret    

c0108dc8 <copy_mm>:

// copy_mm - process "proc" duplicate OR share process "current"'s mm according clone_flags
//         - if clone_flags & CLONE_VM, then "share" ; else "duplicate"
static int
copy_mm(uint32_t clone_flags, struct proc_struct *proc) {
c0108dc8:	f3 0f 1e fb          	endbr32 
c0108dcc:	55                   	push   %ebp
c0108dcd:	89 e5                	mov    %esp,%ebp
c0108dcf:	83 ec 18             	sub    $0x18,%esp
    assert(current->mm == NULL);
c0108dd2:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0108dd7:	8b 40 18             	mov    0x18(%eax),%eax
c0108dda:	85 c0                	test   %eax,%eax
c0108ddc:	74 24                	je     c0108e02 <copy_mm+0x3a>
c0108dde:	c7 44 24 0c c4 bf 10 	movl   $0xc010bfc4,0xc(%esp)
c0108de5:	c0 
c0108de6:	c7 44 24 08 d8 bf 10 	movl   $0xc010bfd8,0x8(%esp)
c0108ded:	c0 
c0108dee:	c7 44 24 04 ef 00 00 	movl   $0xef,0x4(%esp)
c0108df5:	00 
c0108df6:	c7 04 24 ed bf 10 c0 	movl   $0xc010bfed,(%esp)
c0108dfd:	e8 3b 76 ff ff       	call   c010043d <__panic>
    /* do nothing in this project */
    return 0;
c0108e02:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108e07:	c9                   	leave  
c0108e08:	c3                   	ret    

c0108e09 <copy_thread>:

// copy_thread - setup the trapframe on the  process's kernel stack top and
//             - setup the kernel entry point and stack of process
static void
copy_thread(struct proc_struct *proc, uintptr_t esp, struct trapframe *tf) {
c0108e09:	f3 0f 1e fb          	endbr32 
c0108e0d:	55                   	push   %ebp
c0108e0e:	89 e5                	mov    %esp,%ebp
c0108e10:	57                   	push   %edi
c0108e11:	56                   	push   %esi
c0108e12:	53                   	push   %ebx
    proc->tf = (struct trapframe *)(proc->kstack + KSTACKSIZE) - 1;
c0108e13:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e16:	8b 40 0c             	mov    0xc(%eax),%eax
c0108e19:	05 b4 1f 00 00       	add    $0x1fb4,%eax
c0108e1e:	89 c2                	mov    %eax,%edx
c0108e20:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e23:	89 50 3c             	mov    %edx,0x3c(%eax)
    *(proc->tf) = *tf;
c0108e26:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e29:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108e2c:	8b 55 10             	mov    0x10(%ebp),%edx
c0108e2f:	bb 4c 00 00 00       	mov    $0x4c,%ebx
c0108e34:	89 c1                	mov    %eax,%ecx
c0108e36:	83 e1 01             	and    $0x1,%ecx
c0108e39:	85 c9                	test   %ecx,%ecx
c0108e3b:	74 0c                	je     c0108e49 <copy_thread+0x40>
c0108e3d:	0f b6 0a             	movzbl (%edx),%ecx
c0108e40:	88 08                	mov    %cl,(%eax)
c0108e42:	8d 40 01             	lea    0x1(%eax),%eax
c0108e45:	8d 52 01             	lea    0x1(%edx),%edx
c0108e48:	4b                   	dec    %ebx
c0108e49:	89 c1                	mov    %eax,%ecx
c0108e4b:	83 e1 02             	and    $0x2,%ecx
c0108e4e:	85 c9                	test   %ecx,%ecx
c0108e50:	74 0f                	je     c0108e61 <copy_thread+0x58>
c0108e52:	0f b7 0a             	movzwl (%edx),%ecx
c0108e55:	66 89 08             	mov    %cx,(%eax)
c0108e58:	8d 40 02             	lea    0x2(%eax),%eax
c0108e5b:	8d 52 02             	lea    0x2(%edx),%edx
c0108e5e:	83 eb 02             	sub    $0x2,%ebx
c0108e61:	89 df                	mov    %ebx,%edi
c0108e63:	83 e7 fc             	and    $0xfffffffc,%edi
c0108e66:	b9 00 00 00 00       	mov    $0x0,%ecx
c0108e6b:	8b 34 0a             	mov    (%edx,%ecx,1),%esi
c0108e6e:	89 34 08             	mov    %esi,(%eax,%ecx,1)
c0108e71:	83 c1 04             	add    $0x4,%ecx
c0108e74:	39 f9                	cmp    %edi,%ecx
c0108e76:	72 f3                	jb     c0108e6b <copy_thread+0x62>
c0108e78:	01 c8                	add    %ecx,%eax
c0108e7a:	01 ca                	add    %ecx,%edx
c0108e7c:	b9 00 00 00 00       	mov    $0x0,%ecx
c0108e81:	89 de                	mov    %ebx,%esi
c0108e83:	83 e6 02             	and    $0x2,%esi
c0108e86:	85 f6                	test   %esi,%esi
c0108e88:	74 0b                	je     c0108e95 <copy_thread+0x8c>
c0108e8a:	0f b7 34 0a          	movzwl (%edx,%ecx,1),%esi
c0108e8e:	66 89 34 08          	mov    %si,(%eax,%ecx,1)
c0108e92:	83 c1 02             	add    $0x2,%ecx
c0108e95:	83 e3 01             	and    $0x1,%ebx
c0108e98:	85 db                	test   %ebx,%ebx
c0108e9a:	74 07                	je     c0108ea3 <copy_thread+0x9a>
c0108e9c:	0f b6 14 0a          	movzbl (%edx,%ecx,1),%edx
c0108ea0:	88 14 08             	mov    %dl,(%eax,%ecx,1)
    proc->tf->tf_regs.reg_eax = 0;
c0108ea3:	8b 45 08             	mov    0x8(%ebp),%eax
c0108ea6:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108ea9:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
    proc->tf->tf_esp = esp;
c0108eb0:	8b 45 08             	mov    0x8(%ebp),%eax
c0108eb3:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108eb6:	8b 55 0c             	mov    0xc(%ebp),%edx
c0108eb9:	89 50 44             	mov    %edx,0x44(%eax)
    proc->tf->tf_eflags |= FL_IF;
c0108ebc:	8b 45 08             	mov    0x8(%ebp),%eax
c0108ebf:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108ec2:	8b 50 40             	mov    0x40(%eax),%edx
c0108ec5:	8b 45 08             	mov    0x8(%ebp),%eax
c0108ec8:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108ecb:	81 ca 00 02 00 00    	or     $0x200,%edx
c0108ed1:	89 50 40             	mov    %edx,0x40(%eax)

    proc->context.eip = (uintptr_t)forkret;
c0108ed4:	ba ce 8b 10 c0       	mov    $0xc0108bce,%edx
c0108ed9:	8b 45 08             	mov    0x8(%ebp),%eax
c0108edc:	89 50 1c             	mov    %edx,0x1c(%eax)
    proc->context.esp = (uintptr_t)(proc->tf);
c0108edf:	8b 45 08             	mov    0x8(%ebp),%eax
c0108ee2:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108ee5:	89 c2                	mov    %eax,%edx
c0108ee7:	8b 45 08             	mov    0x8(%ebp),%eax
c0108eea:	89 50 20             	mov    %edx,0x20(%eax)
}
c0108eed:	90                   	nop
c0108eee:	5b                   	pop    %ebx
c0108eef:	5e                   	pop    %esi
c0108ef0:	5f                   	pop    %edi
c0108ef1:	5d                   	pop    %ebp
c0108ef2:	c3                   	ret    

c0108ef3 <do_fork>:
 * @clone_flags: used to guide how to clone the child process
 * @stack:       the parent's user stack pointer. if stack==0, It means to fork a kernel thread.
 * @tf:          the trapframe info, which will be copied to child process's proc->tf
 */
int
do_fork(uint32_t clone_flags, uintptr_t stack, struct trapframe *tf) {
c0108ef3:	f3 0f 1e fb          	endbr32 
c0108ef7:	55                   	push   %ebp
c0108ef8:	89 e5                	mov    %esp,%ebp
c0108efa:	83 ec 38             	sub    $0x38,%esp
    int ret = -E_NO_FREE_PROC;
c0108efd:	c7 45 f4 fb ff ff ff 	movl   $0xfffffffb,-0xc(%ebp)
    struct proc_struct *proc;
    if (nr_process >= MAX_PROCESS) {
c0108f04:	a1 40 e0 12 c0       	mov    0xc012e040,%eax
c0108f09:	3d ff 0f 00 00       	cmp    $0xfff,%eax
c0108f0e:	0f 8f ff 00 00 00    	jg     c0109013 <do_fork+0x120>
        goto fork_out;
    }
    ret = -E_NO_MEM;
c0108f14:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)
     * VARIABLES:
     *   proc_list:    the process set's list
     *   nr_process:   the number of process set
     */
    
    if(!(proc=alloc_proc())) goto fork_out;//    1. call alloc_proc to allocate a proc_struct
c0108f1b:	e8 e4 f9 ff ff       	call   c0108904 <alloc_proc>
c0108f20:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108f23:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108f27:	0f 84 e9 00 00 00    	je     c0109016 <do_fork+0x123>
    proc->parent=current;//   copy_thread:  setup the trapframe on the  process's kernel stack top and
c0108f2d:	8b 15 28 c0 12 c0    	mov    0xc012c028,%edx
c0108f33:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f36:	89 50 14             	mov    %edx,0x14(%eax)
    if(setup_kstack(proc)) goto bad_fork_cleanup_proc;//    2. call setup_kstack to allocate a kernel stack for child process
c0108f39:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f3c:	89 04 24             	mov    %eax,(%esp)
c0108f3f:	e8 19 fe ff ff       	call   c0108d5d <setup_kstack>
c0108f44:	85 c0                	test   %eax,%eax
c0108f46:	0f 85 e2 00 00 00    	jne    c010902e <do_fork+0x13b>
    if(copy_mm(clone_flags,proc)) goto bad_fork_cleanup_kstack;//    3. call copy_mm to dup OR share mm according clone_flag
c0108f4c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f4f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108f53:	8b 45 08             	mov    0x8(%ebp),%eax
c0108f56:	89 04 24             	mov    %eax,(%esp)
c0108f59:	e8 6a fe ff ff       	call   c0108dc8 <copy_mm>
c0108f5e:	85 c0                	test   %eax,%eax
c0108f60:	0f 85 b6 00 00 00    	jne    c010901c <do_fork+0x129>
    copy_thread(proc,stack,tf);//    4. call copy_thread to setup tf & context in proc_struct
c0108f66:	8b 45 10             	mov    0x10(%ebp),%eax
c0108f69:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108f6d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108f70:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108f74:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f77:	89 04 24             	mov    %eax,(%esp)
c0108f7a:	e8 8a fe ff ff       	call   c0108e09 <copy_thread>
    bool intr;
    //    5. insert proc_struct into hash_list && proc_list
    local_intr_save(intr);
c0108f7f:	e8 35 f8 ff ff       	call   c01087b9 <__intr_save>
c0108f84:	89 45 ec             	mov    %eax,-0x14(%ebp)
    {         
	    proc->pid=get_pid();
c0108f87:	e8 ce fa ff ff       	call   c0108a5a <get_pid>
c0108f8c:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108f8f:	89 42 04             	mov    %eax,0x4(%edx)
	    hash_proc(proc);
c0108f92:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f95:	89 04 24             	mov    %eax,(%esp)
c0108f98:	e8 4e fc ff ff       	call   c0108beb <hash_proc>
	    nr_process++;
c0108f9d:	a1 40 e0 12 c0       	mov    0xc012e040,%eax
c0108fa2:	40                   	inc    %eax
c0108fa3:	a3 40 e0 12 c0       	mov    %eax,0xc012e040
	    list_add_before(&proc_list,&(proc->list_link));
c0108fa8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108fab:	83 c0 58             	add    $0x58,%eax
c0108fae:	c7 45 e8 50 e1 12 c0 	movl   $0xc012e150,-0x18(%ebp)
c0108fb5:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    __list_add(elm, listelm->prev, listelm);
c0108fb8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108fbb:	8b 00                	mov    (%eax),%eax
c0108fbd:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0108fc0:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0108fc3:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0108fc6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108fc9:	89 45 d8             	mov    %eax,-0x28(%ebp)
    prev->next = next->prev = elm;
c0108fcc:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108fcf:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108fd2:	89 10                	mov    %edx,(%eax)
c0108fd4:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108fd7:	8b 10                	mov    (%eax),%edx
c0108fd9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108fdc:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0108fdf:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108fe2:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0108fe5:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0108fe8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108feb:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0108fee:	89 10                	mov    %edx,(%eax)
}
c0108ff0:	90                   	nop
}
c0108ff1:	90                   	nop
    }
    local_intr_restore(intr);
c0108ff2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108ff5:	89 04 24             	mov    %eax,(%esp)
c0108ff8:	e8 e6 f7 ff ff       	call   c01087e3 <__intr_restore>
    wakeup_proc(proc);//    6. call wakeup_proc to make the new child process RUNNABLE
c0108ffd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109000:	89 04 24             	mov    %eax,(%esp)
c0109003:	e8 d4 02 00 00       	call   c01092dc <wakeup_proc>
    ret=proc->pid;//    7. set ret vaule using child proc's pid
c0109008:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010900b:	8b 40 04             	mov    0x4(%eax),%eax
c010900e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109011:	eb 04                	jmp    c0109017 <do_fork+0x124>
        goto fork_out;
c0109013:	90                   	nop
c0109014:	eb 01                	jmp    c0109017 <do_fork+0x124>
    if(!(proc=alloc_proc())) goto fork_out;//    1. call alloc_proc to allocate a proc_struct
c0109016:	90                   	nop
fork_out:
    return ret;
c0109017:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010901a:	eb 20                	jmp    c010903c <do_fork+0x149>
    if(copy_mm(clone_flags,proc)) goto bad_fork_cleanup_kstack;//    3. call copy_mm to dup OR share mm according clone_flag
c010901c:	90                   	nop
c010901d:	f3 0f 1e fb          	endbr32 

bad_fork_cleanup_kstack:
    put_kstack(proc);
c0109021:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109024:	89 04 24             	mov    %eax,(%esp)
c0109027:	e8 71 fd ff ff       	call   c0108d9d <put_kstack>
c010902c:	eb 01                	jmp    c010902f <do_fork+0x13c>
    if(setup_kstack(proc)) goto bad_fork_cleanup_proc;//    2. call setup_kstack to allocate a kernel stack for child process
c010902e:	90                   	nop
bad_fork_cleanup_proc:
    kfree(proc);
c010902f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109032:	89 04 24             	mov    %eax,(%esp)
c0109035:	e8 42 d6 ff ff       	call   c010667c <kfree>
    goto fork_out;
c010903a:	eb db                	jmp    c0109017 <do_fork+0x124>
}
c010903c:	c9                   	leave  
c010903d:	c3                   	ret    

c010903e <do_exit>:
// do_exit - called by sys_exit
//   1. call exit_mmap & put_pgdir & mm_destroy to free the almost all memory space of process
//   2. set process' state as PROC_ZOMBIE, then call wakeup_proc(parent) to ask parent reclaim itself.
//   3. call scheduler to switch to other process
int
do_exit(int error_code) {
c010903e:	f3 0f 1e fb          	endbr32 
c0109042:	55                   	push   %ebp
c0109043:	89 e5                	mov    %esp,%ebp
c0109045:	83 ec 18             	sub    $0x18,%esp
    panic("process exit!!.\n");
c0109048:	c7 44 24 08 01 c0 10 	movl   $0xc010c001,0x8(%esp)
c010904f:	c0 
c0109050:	c7 44 24 04 42 01 00 	movl   $0x142,0x4(%esp)
c0109057:	00 
c0109058:	c7 04 24 ed bf 10 c0 	movl   $0xc010bfed,(%esp)
c010905f:	e8 d9 73 ff ff       	call   c010043d <__panic>

c0109064 <init_main>:
}

// init_main - the second kernel thread used to create user_main kernel threads
static int
init_main(void *arg) {
c0109064:	f3 0f 1e fb          	endbr32 
c0109068:	55                   	push   %ebp
c0109069:	89 e5                	mov    %esp,%ebp
c010906b:	83 ec 18             	sub    $0x18,%esp
    cprintf("this initproc, pid = %d, name = \"%s\"\n", current->pid, get_proc_name(current));
c010906e:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0109073:	89 04 24             	mov    %eax,(%esp)
c0109076:	e8 99 f9 ff ff       	call   c0108a14 <get_proc_name>
c010907b:	8b 15 28 c0 12 c0    	mov    0xc012c028,%edx
c0109081:	8b 52 04             	mov    0x4(%edx),%edx
c0109084:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109088:	89 54 24 04          	mov    %edx,0x4(%esp)
c010908c:	c7 04 24 14 c0 10 c0 	movl   $0xc010c014,(%esp)
c0109093:	e8 39 72 ff ff       	call   c01002d1 <cprintf>
    cprintf("To U: \"%s\".\n", (const char *)arg);
c0109098:	8b 45 08             	mov    0x8(%ebp),%eax
c010909b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010909f:	c7 04 24 3a c0 10 c0 	movl   $0xc010c03a,(%esp)
c01090a6:	e8 26 72 ff ff       	call   c01002d1 <cprintf>
    cprintf("To U: \"en.., Bye, Bye. :)\"\n");
c01090ab:	c7 04 24 47 c0 10 c0 	movl   $0xc010c047,(%esp)
c01090b2:	e8 1a 72 ff ff       	call   c01002d1 <cprintf>
    return 0;
c01090b7:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01090bc:	c9                   	leave  
c01090bd:	c3                   	ret    

c01090be <proc_init>:

// proc_init - set up the first kernel thread idleproc "idle" by itself and 
//           - create the second kernel thread init_main
void
proc_init(void) {
c01090be:	f3 0f 1e fb          	endbr32 
c01090c2:	55                   	push   %ebp
c01090c3:	89 e5                	mov    %esp,%ebp
c01090c5:	83 ec 28             	sub    $0x28,%esp
c01090c8:	c7 45 ec 50 e1 12 c0 	movl   $0xc012e150,-0x14(%ebp)
    elm->prev = elm->next = elm;
c01090cf:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01090d2:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01090d5:	89 50 04             	mov    %edx,0x4(%eax)
c01090d8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01090db:	8b 50 04             	mov    0x4(%eax),%edx
c01090de:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01090e1:	89 10                	mov    %edx,(%eax)
}
c01090e3:	90                   	nop
    int i;

    list_init(&proc_list);
    for (i = 0; i < HASH_LIST_SIZE; i ++) {
c01090e4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01090eb:	eb 26                	jmp    c0109113 <proc_init+0x55>
        list_init(hash_list + i);
c01090ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01090f0:	c1 e0 03             	shl    $0x3,%eax
c01090f3:	05 40 c0 12 c0       	add    $0xc012c040,%eax
c01090f8:	89 45 e8             	mov    %eax,-0x18(%ebp)
    elm->prev = elm->next = elm;
c01090fb:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01090fe:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0109101:	89 50 04             	mov    %edx,0x4(%eax)
c0109104:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109107:	8b 50 04             	mov    0x4(%eax),%edx
c010910a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010910d:	89 10                	mov    %edx,(%eax)
}
c010910f:	90                   	nop
    for (i = 0; i < HASH_LIST_SIZE; i ++) {
c0109110:	ff 45 f4             	incl   -0xc(%ebp)
c0109113:	81 7d f4 ff 03 00 00 	cmpl   $0x3ff,-0xc(%ebp)
c010911a:	7e d1                	jle    c01090ed <proc_init+0x2f>
    }

    if ((idleproc = alloc_proc()) == NULL) {
c010911c:	e8 e3 f7 ff ff       	call   c0108904 <alloc_proc>
c0109121:	a3 20 c0 12 c0       	mov    %eax,0xc012c020
c0109126:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c010912b:	85 c0                	test   %eax,%eax
c010912d:	75 1c                	jne    c010914b <proc_init+0x8d>
        panic("cannot alloc idleproc.\n");
c010912f:	c7 44 24 08 63 c0 10 	movl   $0xc010c063,0x8(%esp)
c0109136:	c0 
c0109137:	c7 44 24 04 5a 01 00 	movl   $0x15a,0x4(%esp)
c010913e:	00 
c010913f:	c7 04 24 ed bf 10 c0 	movl   $0xc010bfed,(%esp)
c0109146:	e8 f2 72 ff ff       	call   c010043d <__panic>
    }

    idleproc->pid = 0;
c010914b:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109150:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    idleproc->state = PROC_RUNNABLE;
c0109157:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c010915c:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
    idleproc->kstack = (uintptr_t)bootstack;
c0109162:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109167:	ba 00 60 12 c0       	mov    $0xc0126000,%edx
c010916c:	89 50 0c             	mov    %edx,0xc(%eax)
    idleproc->need_resched = 1;
c010916f:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109174:	c7 40 10 01 00 00 00 	movl   $0x1,0x10(%eax)
    set_proc_name(idleproc, "idle");
c010917b:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109180:	c7 44 24 04 7b c0 10 	movl   $0xc010c07b,0x4(%esp)
c0109187:	c0 
c0109188:	89 04 24             	mov    %eax,(%esp)
c010918b:	e8 3d f8 ff ff       	call   c01089cd <set_proc_name>
    nr_process ++;
c0109190:	a1 40 e0 12 c0       	mov    0xc012e040,%eax
c0109195:	40                   	inc    %eax
c0109196:	a3 40 e0 12 c0       	mov    %eax,0xc012e040

    current = idleproc;
c010919b:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c01091a0:	a3 28 c0 12 c0       	mov    %eax,0xc012c028

    int pid = kernel_thread(init_main, "Hello world!!", 0);
c01091a5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01091ac:	00 
c01091ad:	c7 44 24 04 80 c0 10 	movl   $0xc010c080,0x4(%esp)
c01091b4:	c0 
c01091b5:	c7 04 24 64 90 10 c0 	movl   $0xc0109064,(%esp)
c01091bc:	e8 24 fb ff ff       	call   c0108ce5 <kernel_thread>
c01091c1:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (pid <= 0) {
c01091c4:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01091c8:	7f 1c                	jg     c01091e6 <proc_init+0x128>
        panic("create init_main failed.\n");
c01091ca:	c7 44 24 08 8e c0 10 	movl   $0xc010c08e,0x8(%esp)
c01091d1:	c0 
c01091d2:	c7 44 24 04 68 01 00 	movl   $0x168,0x4(%esp)
c01091d9:	00 
c01091da:	c7 04 24 ed bf 10 c0 	movl   $0xc010bfed,(%esp)
c01091e1:	e8 57 72 ff ff       	call   c010043d <__panic>
    }

    initproc = find_proc(pid);
c01091e6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01091e9:	89 04 24             	mov    %eax,(%esp)
c01091ec:	e8 7e fa ff ff       	call   c0108c6f <find_proc>
c01091f1:	a3 24 c0 12 c0       	mov    %eax,0xc012c024
    set_proc_name(initproc, "init");
c01091f6:	a1 24 c0 12 c0       	mov    0xc012c024,%eax
c01091fb:	c7 44 24 04 a8 c0 10 	movl   $0xc010c0a8,0x4(%esp)
c0109202:	c0 
c0109203:	89 04 24             	mov    %eax,(%esp)
c0109206:	e8 c2 f7 ff ff       	call   c01089cd <set_proc_name>

    assert(idleproc != NULL && idleproc->pid == 0);
c010920b:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109210:	85 c0                	test   %eax,%eax
c0109212:	74 0c                	je     c0109220 <proc_init+0x162>
c0109214:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109219:	8b 40 04             	mov    0x4(%eax),%eax
c010921c:	85 c0                	test   %eax,%eax
c010921e:	74 24                	je     c0109244 <proc_init+0x186>
c0109220:	c7 44 24 0c b0 c0 10 	movl   $0xc010c0b0,0xc(%esp)
c0109227:	c0 
c0109228:	c7 44 24 08 d8 bf 10 	movl   $0xc010bfd8,0x8(%esp)
c010922f:	c0 
c0109230:	c7 44 24 04 6e 01 00 	movl   $0x16e,0x4(%esp)
c0109237:	00 
c0109238:	c7 04 24 ed bf 10 c0 	movl   $0xc010bfed,(%esp)
c010923f:	e8 f9 71 ff ff       	call   c010043d <__panic>
    assert(initproc != NULL && initproc->pid == 1);
c0109244:	a1 24 c0 12 c0       	mov    0xc012c024,%eax
c0109249:	85 c0                	test   %eax,%eax
c010924b:	74 0d                	je     c010925a <proc_init+0x19c>
c010924d:	a1 24 c0 12 c0       	mov    0xc012c024,%eax
c0109252:	8b 40 04             	mov    0x4(%eax),%eax
c0109255:	83 f8 01             	cmp    $0x1,%eax
c0109258:	74 24                	je     c010927e <proc_init+0x1c0>
c010925a:	c7 44 24 0c d8 c0 10 	movl   $0xc010c0d8,0xc(%esp)
c0109261:	c0 
c0109262:	c7 44 24 08 d8 bf 10 	movl   $0xc010bfd8,0x8(%esp)
c0109269:	c0 
c010926a:	c7 44 24 04 6f 01 00 	movl   $0x16f,0x4(%esp)
c0109271:	00 
c0109272:	c7 04 24 ed bf 10 c0 	movl   $0xc010bfed,(%esp)
c0109279:	e8 bf 71 ff ff       	call   c010043d <__panic>
}
c010927e:	90                   	nop
c010927f:	c9                   	leave  
c0109280:	c3                   	ret    

c0109281 <cpu_idle>:

// cpu_idle - at the end of kern_init, the first kernel thread idleproc will do below works
void
cpu_idle(void) {
c0109281:	f3 0f 1e fb          	endbr32 
c0109285:	55                   	push   %ebp
c0109286:	89 e5                	mov    %esp,%ebp
c0109288:	83 ec 08             	sub    $0x8,%esp
    while (1) {
        if (current->need_resched) {
c010928b:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0109290:	8b 40 10             	mov    0x10(%eax),%eax
c0109293:	85 c0                	test   %eax,%eax
c0109295:	74 f4                	je     c010928b <cpu_idle+0xa>
            schedule();
c0109297:	e8 8e 00 00 00       	call   c010932a <schedule>
        if (current->need_resched) {
c010929c:	eb ed                	jmp    c010928b <cpu_idle+0xa>

c010929e <__intr_save>:
__intr_save(void) {
c010929e:	55                   	push   %ebp
c010929f:	89 e5                	mov    %esp,%ebp
c01092a1:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01092a4:	9c                   	pushf  
c01092a5:	58                   	pop    %eax
c01092a6:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c01092a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c01092ac:	25 00 02 00 00       	and    $0x200,%eax
c01092b1:	85 c0                	test   %eax,%eax
c01092b3:	74 0c                	je     c01092c1 <__intr_save+0x23>
        intr_disable();
c01092b5:	e8 4a 8f ff ff       	call   c0102204 <intr_disable>
        return 1;
c01092ba:	b8 01 00 00 00       	mov    $0x1,%eax
c01092bf:	eb 05                	jmp    c01092c6 <__intr_save+0x28>
    return 0;
c01092c1:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01092c6:	c9                   	leave  
c01092c7:	c3                   	ret    

c01092c8 <__intr_restore>:
__intr_restore(bool flag) {
c01092c8:	55                   	push   %ebp
c01092c9:	89 e5                	mov    %esp,%ebp
c01092cb:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c01092ce:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01092d2:	74 05                	je     c01092d9 <__intr_restore+0x11>
        intr_enable();
c01092d4:	e8 1f 8f ff ff       	call   c01021f8 <intr_enable>
}
c01092d9:	90                   	nop
c01092da:	c9                   	leave  
c01092db:	c3                   	ret    

c01092dc <wakeup_proc>:
#include <proc.h>
#include <sched.h>
#include <assert.h>

void
wakeup_proc(struct proc_struct *proc) {
c01092dc:	f3 0f 1e fb          	endbr32 
c01092e0:	55                   	push   %ebp
c01092e1:	89 e5                	mov    %esp,%ebp
c01092e3:	83 ec 18             	sub    $0x18,%esp
    assert(proc->state != PROC_ZOMBIE && proc->state != PROC_RUNNABLE);
c01092e6:	8b 45 08             	mov    0x8(%ebp),%eax
c01092e9:	8b 00                	mov    (%eax),%eax
c01092eb:	83 f8 03             	cmp    $0x3,%eax
c01092ee:	74 0a                	je     c01092fa <wakeup_proc+0x1e>
c01092f0:	8b 45 08             	mov    0x8(%ebp),%eax
c01092f3:	8b 00                	mov    (%eax),%eax
c01092f5:	83 f8 02             	cmp    $0x2,%eax
c01092f8:	75 24                	jne    c010931e <wakeup_proc+0x42>
c01092fa:	c7 44 24 0c 00 c1 10 	movl   $0xc010c100,0xc(%esp)
c0109301:	c0 
c0109302:	c7 44 24 08 3b c1 10 	movl   $0xc010c13b,0x8(%esp)
c0109309:	c0 
c010930a:	c7 44 24 04 09 00 00 	movl   $0x9,0x4(%esp)
c0109311:	00 
c0109312:	c7 04 24 50 c1 10 c0 	movl   $0xc010c150,(%esp)
c0109319:	e8 1f 71 ff ff       	call   c010043d <__panic>
    proc->state = PROC_RUNNABLE;
c010931e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109321:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
}
c0109327:	90                   	nop
c0109328:	c9                   	leave  
c0109329:	c3                   	ret    

c010932a <schedule>:

void
schedule(void) {
c010932a:	f3 0f 1e fb          	endbr32 
c010932e:	55                   	push   %ebp
c010932f:	89 e5                	mov    %esp,%ebp
c0109331:	83 ec 38             	sub    $0x38,%esp
    bool intr_flag;
    list_entry_t *le, *last;
    struct proc_struct *next = NULL;
c0109334:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    local_intr_save(intr_flag);
c010933b:	e8 5e ff ff ff       	call   c010929e <__intr_save>
c0109340:	89 45 ec             	mov    %eax,-0x14(%ebp)
    {
        current->need_resched = 0;
c0109343:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0109348:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        last = (current == idleproc) ? &proc_list : &(current->list_link);
c010934f:	8b 15 28 c0 12 c0    	mov    0xc012c028,%edx
c0109355:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c010935a:	39 c2                	cmp    %eax,%edx
c010935c:	74 0a                	je     c0109368 <schedule+0x3e>
c010935e:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0109363:	83 c0 58             	add    $0x58,%eax
c0109366:	eb 05                	jmp    c010936d <schedule+0x43>
c0109368:	b8 50 e1 12 c0       	mov    $0xc012e150,%eax
c010936d:	89 45 e8             	mov    %eax,-0x18(%ebp)
        le = last;
c0109370:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109373:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109376:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109379:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return listelm->next;
c010937c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010937f:	8b 40 04             	mov    0x4(%eax),%eax
        do {
            if ((le = list_next(le)) != &proc_list) {
c0109382:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109385:	81 7d f4 50 e1 12 c0 	cmpl   $0xc012e150,-0xc(%ebp)
c010938c:	74 13                	je     c01093a1 <schedule+0x77>
                next = le2proc(le, list_link);
c010938e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109391:	83 e8 58             	sub    $0x58,%eax
c0109394:	89 45 f0             	mov    %eax,-0x10(%ebp)
                if (next->state == PROC_RUNNABLE) {
c0109397:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010939a:	8b 00                	mov    (%eax),%eax
c010939c:	83 f8 02             	cmp    $0x2,%eax
c010939f:	74 0a                	je     c01093ab <schedule+0x81>
                    break;
                }
            }
        } while (le != last);
c01093a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01093a4:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c01093a7:	75 cd                	jne    c0109376 <schedule+0x4c>
c01093a9:	eb 01                	jmp    c01093ac <schedule+0x82>
                    break;
c01093ab:	90                   	nop
        if (next == NULL || next->state != PROC_RUNNABLE) {
c01093ac:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01093b0:	74 0a                	je     c01093bc <schedule+0x92>
c01093b2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093b5:	8b 00                	mov    (%eax),%eax
c01093b7:	83 f8 02             	cmp    $0x2,%eax
c01093ba:	74 08                	je     c01093c4 <schedule+0x9a>
            next = idleproc;
c01093bc:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c01093c1:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        next->runs ++;
c01093c4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093c7:	8b 40 08             	mov    0x8(%eax),%eax
c01093ca:	8d 50 01             	lea    0x1(%eax),%edx
c01093cd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093d0:	89 50 08             	mov    %edx,0x8(%eax)
        if (next != current) {
c01093d3:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c01093d8:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01093db:	74 0b                	je     c01093e8 <schedule+0xbe>
            proc_run(next);
c01093dd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093e0:	89 04 24             	mov    %eax,(%esp)
c01093e3:	e8 6b f7 ff ff       	call   c0108b53 <proc_run>
        }
    }
    local_intr_restore(intr_flag);
c01093e8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01093eb:	89 04 24             	mov    %eax,(%esp)
c01093ee:	e8 d5 fe ff ff       	call   c01092c8 <__intr_restore>
}
c01093f3:	90                   	nop
c01093f4:	c9                   	leave  
c01093f5:	c3                   	ret    

c01093f6 <strlen>:
 * @s:      the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
c01093f6:	f3 0f 1e fb          	endbr32 
c01093fa:	55                   	push   %ebp
c01093fb:	89 e5                	mov    %esp,%ebp
c01093fd:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c0109400:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (*s ++ != '\0') {
c0109407:	eb 03                	jmp    c010940c <strlen+0x16>
        cnt ++;
c0109409:	ff 45 fc             	incl   -0x4(%ebp)
    while (*s ++ != '\0') {
c010940c:	8b 45 08             	mov    0x8(%ebp),%eax
c010940f:	8d 50 01             	lea    0x1(%eax),%edx
c0109412:	89 55 08             	mov    %edx,0x8(%ebp)
c0109415:	0f b6 00             	movzbl (%eax),%eax
c0109418:	84 c0                	test   %al,%al
c010941a:	75 ed                	jne    c0109409 <strlen+0x13>
    }
    return cnt;
c010941c:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c010941f:	c9                   	leave  
c0109420:	c3                   	ret    

c0109421 <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
c0109421:	f3 0f 1e fb          	endbr32 
c0109425:	55                   	push   %ebp
c0109426:	89 e5                	mov    %esp,%ebp
c0109428:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c010942b:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c0109432:	eb 03                	jmp    c0109437 <strnlen+0x16>
        cnt ++;
c0109434:	ff 45 fc             	incl   -0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c0109437:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010943a:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010943d:	73 10                	jae    c010944f <strnlen+0x2e>
c010943f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109442:	8d 50 01             	lea    0x1(%eax),%edx
c0109445:	89 55 08             	mov    %edx,0x8(%ebp)
c0109448:	0f b6 00             	movzbl (%eax),%eax
c010944b:	84 c0                	test   %al,%al
c010944d:	75 e5                	jne    c0109434 <strnlen+0x13>
    }
    return cnt;
c010944f:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0109452:	c9                   	leave  
c0109453:	c3                   	ret    

c0109454 <strcpy>:
 * To avoid overflows, the size of array pointed by @dst should be long enough to
 * contain the same string as @src (including the terminating null character), and
 * should not overlap in memory with @src.
 * */
char *
strcpy(char *dst, const char *src) {
c0109454:	f3 0f 1e fb          	endbr32 
c0109458:	55                   	push   %ebp
c0109459:	89 e5                	mov    %esp,%ebp
c010945b:	57                   	push   %edi
c010945c:	56                   	push   %esi
c010945d:	83 ec 20             	sub    $0x20,%esp
c0109460:	8b 45 08             	mov    0x8(%ebp),%eax
c0109463:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109466:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109469:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRCPY
static inline char *
__strcpy(char *dst, const char *src) {
    int d0, d1, d2;
    asm volatile (
c010946c:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010946f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109472:	89 d1                	mov    %edx,%ecx
c0109474:	89 c2                	mov    %eax,%edx
c0109476:	89 ce                	mov    %ecx,%esi
c0109478:	89 d7                	mov    %edx,%edi
c010947a:	ac                   	lods   %ds:(%esi),%al
c010947b:	aa                   	stos   %al,%es:(%edi)
c010947c:	84 c0                	test   %al,%al
c010947e:	75 fa                	jne    c010947a <strcpy+0x26>
c0109480:	89 fa                	mov    %edi,%edx
c0109482:	89 f1                	mov    %esi,%ecx
c0109484:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c0109487:	89 55 e8             	mov    %edx,-0x18(%ebp)
c010948a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        : "=&S" (d0), "=&D" (d1), "=&a" (d2)
        : "0" (src), "1" (dst) : "memory");
    return dst;
c010948d:	8b 45 f4             	mov    -0xc(%ebp),%eax
    char *p = dst;
    while ((*p ++ = *src ++) != '\0')
        /* nothing */;
    return dst;
#endif /* __HAVE_ARCH_STRCPY */
}
c0109490:	83 c4 20             	add    $0x20,%esp
c0109493:	5e                   	pop    %esi
c0109494:	5f                   	pop    %edi
c0109495:	5d                   	pop    %ebp
c0109496:	c3                   	ret    

c0109497 <strncpy>:
 * @len:    maximum number of characters to be copied from @src
 *
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
c0109497:	f3 0f 1e fb          	endbr32 
c010949b:	55                   	push   %ebp
c010949c:	89 e5                	mov    %esp,%ebp
c010949e:	83 ec 10             	sub    $0x10,%esp
    char *p = dst;
c01094a1:	8b 45 08             	mov    0x8(%ebp),%eax
c01094a4:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (len > 0) {
c01094a7:	eb 1e                	jmp    c01094c7 <strncpy+0x30>
        if ((*p = *src) != '\0') {
c01094a9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01094ac:	0f b6 10             	movzbl (%eax),%edx
c01094af:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01094b2:	88 10                	mov    %dl,(%eax)
c01094b4:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01094b7:	0f b6 00             	movzbl (%eax),%eax
c01094ba:	84 c0                	test   %al,%al
c01094bc:	74 03                	je     c01094c1 <strncpy+0x2a>
            src ++;
c01094be:	ff 45 0c             	incl   0xc(%ebp)
        }
        p ++, len --;
c01094c1:	ff 45 fc             	incl   -0x4(%ebp)
c01094c4:	ff 4d 10             	decl   0x10(%ebp)
    while (len > 0) {
c01094c7:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01094cb:	75 dc                	jne    c01094a9 <strncpy+0x12>
    }
    return dst;
c01094cd:	8b 45 08             	mov    0x8(%ebp),%eax
}
c01094d0:	c9                   	leave  
c01094d1:	c3                   	ret    

c01094d2 <strcmp>:
 * - A value greater than zero indicates that the first character that does
 *   not match has a greater value in @s1 than in @s2;
 * - And a value less than zero indicates the opposite.
 * */
int
strcmp(const char *s1, const char *s2) {
c01094d2:	f3 0f 1e fb          	endbr32 
c01094d6:	55                   	push   %ebp
c01094d7:	89 e5                	mov    %esp,%ebp
c01094d9:	57                   	push   %edi
c01094da:	56                   	push   %esi
c01094db:	83 ec 20             	sub    $0x20,%esp
c01094de:	8b 45 08             	mov    0x8(%ebp),%eax
c01094e1:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01094e4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01094e7:	89 45 f0             	mov    %eax,-0x10(%ebp)
    asm volatile (
c01094ea:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01094ed:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01094f0:	89 d1                	mov    %edx,%ecx
c01094f2:	89 c2                	mov    %eax,%edx
c01094f4:	89 ce                	mov    %ecx,%esi
c01094f6:	89 d7                	mov    %edx,%edi
c01094f8:	ac                   	lods   %ds:(%esi),%al
c01094f9:	ae                   	scas   %es:(%edi),%al
c01094fa:	75 08                	jne    c0109504 <strcmp+0x32>
c01094fc:	84 c0                	test   %al,%al
c01094fe:	75 f8                	jne    c01094f8 <strcmp+0x26>
c0109500:	31 c0                	xor    %eax,%eax
c0109502:	eb 04                	jmp    c0109508 <strcmp+0x36>
c0109504:	19 c0                	sbb    %eax,%eax
c0109506:	0c 01                	or     $0x1,%al
c0109508:	89 fa                	mov    %edi,%edx
c010950a:	89 f1                	mov    %esi,%ecx
c010950c:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010950f:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c0109512:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return ret;
c0109515:	8b 45 ec             	mov    -0x14(%ebp),%eax
    while (*s1 != '\0' && *s1 == *s2) {
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
#endif /* __HAVE_ARCH_STRCMP */
}
c0109518:	83 c4 20             	add    $0x20,%esp
c010951b:	5e                   	pop    %esi
c010951c:	5f                   	pop    %edi
c010951d:	5d                   	pop    %ebp
c010951e:	c3                   	ret    

c010951f <strncmp>:
 * they are equal to each other, it continues with the following pairs until
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
c010951f:	f3 0f 1e fb          	endbr32 
c0109523:	55                   	push   %ebp
c0109524:	89 e5                	mov    %esp,%ebp
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c0109526:	eb 09                	jmp    c0109531 <strncmp+0x12>
        n --, s1 ++, s2 ++;
c0109528:	ff 4d 10             	decl   0x10(%ebp)
c010952b:	ff 45 08             	incl   0x8(%ebp)
c010952e:	ff 45 0c             	incl   0xc(%ebp)
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c0109531:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109535:	74 1a                	je     c0109551 <strncmp+0x32>
c0109537:	8b 45 08             	mov    0x8(%ebp),%eax
c010953a:	0f b6 00             	movzbl (%eax),%eax
c010953d:	84 c0                	test   %al,%al
c010953f:	74 10                	je     c0109551 <strncmp+0x32>
c0109541:	8b 45 08             	mov    0x8(%ebp),%eax
c0109544:	0f b6 10             	movzbl (%eax),%edx
c0109547:	8b 45 0c             	mov    0xc(%ebp),%eax
c010954a:	0f b6 00             	movzbl (%eax),%eax
c010954d:	38 c2                	cmp    %al,%dl
c010954f:	74 d7                	je     c0109528 <strncmp+0x9>
    }
    return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2);
c0109551:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109555:	74 18                	je     c010956f <strncmp+0x50>
c0109557:	8b 45 08             	mov    0x8(%ebp),%eax
c010955a:	0f b6 00             	movzbl (%eax),%eax
c010955d:	0f b6 d0             	movzbl %al,%edx
c0109560:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109563:	0f b6 00             	movzbl (%eax),%eax
c0109566:	0f b6 c0             	movzbl %al,%eax
c0109569:	29 c2                	sub    %eax,%edx
c010956b:	89 d0                	mov    %edx,%eax
c010956d:	eb 05                	jmp    c0109574 <strncmp+0x55>
c010956f:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0109574:	5d                   	pop    %ebp
c0109575:	c3                   	ret    

c0109576 <strchr>:
 *
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
c0109576:	f3 0f 1e fb          	endbr32 
c010957a:	55                   	push   %ebp
c010957b:	89 e5                	mov    %esp,%ebp
c010957d:	83 ec 04             	sub    $0x4,%esp
c0109580:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109583:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c0109586:	eb 13                	jmp    c010959b <strchr+0x25>
        if (*s == c) {
c0109588:	8b 45 08             	mov    0x8(%ebp),%eax
c010958b:	0f b6 00             	movzbl (%eax),%eax
c010958e:	38 45 fc             	cmp    %al,-0x4(%ebp)
c0109591:	75 05                	jne    c0109598 <strchr+0x22>
            return (char *)s;
c0109593:	8b 45 08             	mov    0x8(%ebp),%eax
c0109596:	eb 12                	jmp    c01095aa <strchr+0x34>
        }
        s ++;
c0109598:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
c010959b:	8b 45 08             	mov    0x8(%ebp),%eax
c010959e:	0f b6 00             	movzbl (%eax),%eax
c01095a1:	84 c0                	test   %al,%al
c01095a3:	75 e3                	jne    c0109588 <strchr+0x12>
    }
    return NULL;
c01095a5:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01095aa:	c9                   	leave  
c01095ab:	c3                   	ret    

c01095ac <strfind>:
 * The strfind() function is like strchr() except that if @c is
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
c01095ac:	f3 0f 1e fb          	endbr32 
c01095b0:	55                   	push   %ebp
c01095b1:	89 e5                	mov    %esp,%ebp
c01095b3:	83 ec 04             	sub    $0x4,%esp
c01095b6:	8b 45 0c             	mov    0xc(%ebp),%eax
c01095b9:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c01095bc:	eb 0e                	jmp    c01095cc <strfind+0x20>
        if (*s == c) {
c01095be:	8b 45 08             	mov    0x8(%ebp),%eax
c01095c1:	0f b6 00             	movzbl (%eax),%eax
c01095c4:	38 45 fc             	cmp    %al,-0x4(%ebp)
c01095c7:	74 0f                	je     c01095d8 <strfind+0x2c>
            break;
        }
        s ++;
c01095c9:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
c01095cc:	8b 45 08             	mov    0x8(%ebp),%eax
c01095cf:	0f b6 00             	movzbl (%eax),%eax
c01095d2:	84 c0                	test   %al,%al
c01095d4:	75 e8                	jne    c01095be <strfind+0x12>
c01095d6:	eb 01                	jmp    c01095d9 <strfind+0x2d>
            break;
c01095d8:	90                   	nop
    }
    return (char *)s;
c01095d9:	8b 45 08             	mov    0x8(%ebp),%eax
}
c01095dc:	c9                   	leave  
c01095dd:	c3                   	ret    

c01095de <strtol>:
 * an optional "0x" or "0X" prefix.
 *
 * The strtol() function returns the converted integral number as a long int value.
 * */
long
strtol(const char *s, char **endptr, int base) {
c01095de:	f3 0f 1e fb          	endbr32 
c01095e2:	55                   	push   %ebp
c01095e3:	89 e5                	mov    %esp,%ebp
c01095e5:	83 ec 10             	sub    $0x10,%esp
    int neg = 0;
c01095e8:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    long val = 0;
c01095ef:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c01095f6:	eb 03                	jmp    c01095fb <strtol+0x1d>
        s ++;
c01095f8:	ff 45 08             	incl   0x8(%ebp)
    while (*s == ' ' || *s == '\t') {
c01095fb:	8b 45 08             	mov    0x8(%ebp),%eax
c01095fe:	0f b6 00             	movzbl (%eax),%eax
c0109601:	3c 20                	cmp    $0x20,%al
c0109603:	74 f3                	je     c01095f8 <strtol+0x1a>
c0109605:	8b 45 08             	mov    0x8(%ebp),%eax
c0109608:	0f b6 00             	movzbl (%eax),%eax
c010960b:	3c 09                	cmp    $0x9,%al
c010960d:	74 e9                	je     c01095f8 <strtol+0x1a>
    }

    // plus/minus sign
    if (*s == '+') {
c010960f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109612:	0f b6 00             	movzbl (%eax),%eax
c0109615:	3c 2b                	cmp    $0x2b,%al
c0109617:	75 05                	jne    c010961e <strtol+0x40>
        s ++;
c0109619:	ff 45 08             	incl   0x8(%ebp)
c010961c:	eb 14                	jmp    c0109632 <strtol+0x54>
    }
    else if (*s == '-') {
c010961e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109621:	0f b6 00             	movzbl (%eax),%eax
c0109624:	3c 2d                	cmp    $0x2d,%al
c0109626:	75 0a                	jne    c0109632 <strtol+0x54>
        s ++, neg = 1;
c0109628:	ff 45 08             	incl   0x8(%ebp)
c010962b:	c7 45 fc 01 00 00 00 	movl   $0x1,-0x4(%ebp)
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
c0109632:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109636:	74 06                	je     c010963e <strtol+0x60>
c0109638:	83 7d 10 10          	cmpl   $0x10,0x10(%ebp)
c010963c:	75 22                	jne    c0109660 <strtol+0x82>
c010963e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109641:	0f b6 00             	movzbl (%eax),%eax
c0109644:	3c 30                	cmp    $0x30,%al
c0109646:	75 18                	jne    c0109660 <strtol+0x82>
c0109648:	8b 45 08             	mov    0x8(%ebp),%eax
c010964b:	40                   	inc    %eax
c010964c:	0f b6 00             	movzbl (%eax),%eax
c010964f:	3c 78                	cmp    $0x78,%al
c0109651:	75 0d                	jne    c0109660 <strtol+0x82>
        s += 2, base = 16;
c0109653:	83 45 08 02          	addl   $0x2,0x8(%ebp)
c0109657:	c7 45 10 10 00 00 00 	movl   $0x10,0x10(%ebp)
c010965e:	eb 29                	jmp    c0109689 <strtol+0xab>
    }
    else if (base == 0 && s[0] == '0') {
c0109660:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109664:	75 16                	jne    c010967c <strtol+0x9e>
c0109666:	8b 45 08             	mov    0x8(%ebp),%eax
c0109669:	0f b6 00             	movzbl (%eax),%eax
c010966c:	3c 30                	cmp    $0x30,%al
c010966e:	75 0c                	jne    c010967c <strtol+0x9e>
        s ++, base = 8;
c0109670:	ff 45 08             	incl   0x8(%ebp)
c0109673:	c7 45 10 08 00 00 00 	movl   $0x8,0x10(%ebp)
c010967a:	eb 0d                	jmp    c0109689 <strtol+0xab>
    }
    else if (base == 0) {
c010967c:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109680:	75 07                	jne    c0109689 <strtol+0xab>
        base = 10;
c0109682:	c7 45 10 0a 00 00 00 	movl   $0xa,0x10(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
c0109689:	8b 45 08             	mov    0x8(%ebp),%eax
c010968c:	0f b6 00             	movzbl (%eax),%eax
c010968f:	3c 2f                	cmp    $0x2f,%al
c0109691:	7e 1b                	jle    c01096ae <strtol+0xd0>
c0109693:	8b 45 08             	mov    0x8(%ebp),%eax
c0109696:	0f b6 00             	movzbl (%eax),%eax
c0109699:	3c 39                	cmp    $0x39,%al
c010969b:	7f 11                	jg     c01096ae <strtol+0xd0>
            dig = *s - '0';
c010969d:	8b 45 08             	mov    0x8(%ebp),%eax
c01096a0:	0f b6 00             	movzbl (%eax),%eax
c01096a3:	0f be c0             	movsbl %al,%eax
c01096a6:	83 e8 30             	sub    $0x30,%eax
c01096a9:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01096ac:	eb 48                	jmp    c01096f6 <strtol+0x118>
        }
        else if (*s >= 'a' && *s <= 'z') {
c01096ae:	8b 45 08             	mov    0x8(%ebp),%eax
c01096b1:	0f b6 00             	movzbl (%eax),%eax
c01096b4:	3c 60                	cmp    $0x60,%al
c01096b6:	7e 1b                	jle    c01096d3 <strtol+0xf5>
c01096b8:	8b 45 08             	mov    0x8(%ebp),%eax
c01096bb:	0f b6 00             	movzbl (%eax),%eax
c01096be:	3c 7a                	cmp    $0x7a,%al
c01096c0:	7f 11                	jg     c01096d3 <strtol+0xf5>
            dig = *s - 'a' + 10;
c01096c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01096c5:	0f b6 00             	movzbl (%eax),%eax
c01096c8:	0f be c0             	movsbl %al,%eax
c01096cb:	83 e8 57             	sub    $0x57,%eax
c01096ce:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01096d1:	eb 23                	jmp    c01096f6 <strtol+0x118>
        }
        else if (*s >= 'A' && *s <= 'Z') {
c01096d3:	8b 45 08             	mov    0x8(%ebp),%eax
c01096d6:	0f b6 00             	movzbl (%eax),%eax
c01096d9:	3c 40                	cmp    $0x40,%al
c01096db:	7e 3b                	jle    c0109718 <strtol+0x13a>
c01096dd:	8b 45 08             	mov    0x8(%ebp),%eax
c01096e0:	0f b6 00             	movzbl (%eax),%eax
c01096e3:	3c 5a                	cmp    $0x5a,%al
c01096e5:	7f 31                	jg     c0109718 <strtol+0x13a>
            dig = *s - 'A' + 10;
c01096e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01096ea:	0f b6 00             	movzbl (%eax),%eax
c01096ed:	0f be c0             	movsbl %al,%eax
c01096f0:	83 e8 37             	sub    $0x37,%eax
c01096f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
        }
        else {
            break;
        }
        if (dig >= base) {
c01096f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01096f9:	3b 45 10             	cmp    0x10(%ebp),%eax
c01096fc:	7d 19                	jge    c0109717 <strtol+0x139>
            break;
        }
        s ++, val = (val * base) + dig;
c01096fe:	ff 45 08             	incl   0x8(%ebp)
c0109701:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109704:	0f af 45 10          	imul   0x10(%ebp),%eax
c0109708:	89 c2                	mov    %eax,%edx
c010970a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010970d:	01 d0                	add    %edx,%eax
c010970f:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (1) {
c0109712:	e9 72 ff ff ff       	jmp    c0109689 <strtol+0xab>
            break;
c0109717:	90                   	nop
        // we don't properly detect overflow!
    }

    if (endptr) {
c0109718:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010971c:	74 08                	je     c0109726 <strtol+0x148>
        *endptr = (char *) s;
c010971e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109721:	8b 55 08             	mov    0x8(%ebp),%edx
c0109724:	89 10                	mov    %edx,(%eax)
    }
    return (neg ? -val : val);
c0109726:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c010972a:	74 07                	je     c0109733 <strtol+0x155>
c010972c:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010972f:	f7 d8                	neg    %eax
c0109731:	eb 03                	jmp    c0109736 <strtol+0x158>
c0109733:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
c0109736:	c9                   	leave  
c0109737:	c3                   	ret    

c0109738 <memset>:
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
c0109738:	f3 0f 1e fb          	endbr32 
c010973c:	55                   	push   %ebp
c010973d:	89 e5                	mov    %esp,%ebp
c010973f:	57                   	push   %edi
c0109740:	83 ec 24             	sub    $0x24,%esp
c0109743:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109746:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
c0109749:	0f be 55 d8          	movsbl -0x28(%ebp),%edx
c010974d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109750:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0109753:	88 55 f7             	mov    %dl,-0x9(%ebp)
c0109756:	8b 45 10             	mov    0x10(%ebp),%eax
c0109759:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
    int d0, d1;
    asm volatile (
c010975c:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c010975f:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
c0109763:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0109766:	89 d7                	mov    %edx,%edi
c0109768:	f3 aa                	rep stos %al,%es:(%edi)
c010976a:	89 fa                	mov    %edi,%edx
c010976c:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c010976f:	89 55 e8             	mov    %edx,-0x18(%ebp)
        "rep; stosb;"
        : "=&c" (d0), "=&D" (d1)
        : "0" (n), "a" (c), "1" (s)
        : "memory");
    return s;
c0109772:	8b 45 f8             	mov    -0x8(%ebp),%eax
    while (n -- > 0) {
        *p ++ = c;
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
c0109775:	83 c4 24             	add    $0x24,%esp
c0109778:	5f                   	pop    %edi
c0109779:	5d                   	pop    %ebp
c010977a:	c3                   	ret    

c010977b <memmove>:
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
c010977b:	f3 0f 1e fb          	endbr32 
c010977f:	55                   	push   %ebp
c0109780:	89 e5                	mov    %esp,%ebp
c0109782:	57                   	push   %edi
c0109783:	56                   	push   %esi
c0109784:	53                   	push   %ebx
c0109785:	83 ec 30             	sub    $0x30,%esp
c0109788:	8b 45 08             	mov    0x8(%ebp),%eax
c010978b:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010978e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109791:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109794:	8b 45 10             	mov    0x10(%ebp),%eax
c0109797:	89 45 e8             	mov    %eax,-0x18(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
c010979a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010979d:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01097a0:	73 42                	jae    c01097e4 <memmove+0x69>
c01097a2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01097a5:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01097a8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01097ab:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01097ae:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01097b1:	89 45 dc             	mov    %eax,-0x24(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c01097b4:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01097b7:	c1 e8 02             	shr    $0x2,%eax
c01097ba:	89 c1                	mov    %eax,%ecx
    asm volatile (
c01097bc:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01097bf:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01097c2:	89 d7                	mov    %edx,%edi
c01097c4:	89 c6                	mov    %eax,%esi
c01097c6:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c01097c8:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c01097cb:	83 e1 03             	and    $0x3,%ecx
c01097ce:	74 02                	je     c01097d2 <memmove+0x57>
c01097d0:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c01097d2:	89 f0                	mov    %esi,%eax
c01097d4:	89 fa                	mov    %edi,%edx
c01097d6:	89 4d d8             	mov    %ecx,-0x28(%ebp)
c01097d9:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c01097dc:	89 45 d0             	mov    %eax,-0x30(%ebp)
        : "memory");
    return dst;
c01097df:	8b 45 e4             	mov    -0x1c(%ebp),%eax
        return __memcpy(dst, src, n);
c01097e2:	eb 36                	jmp    c010981a <memmove+0x9f>
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
c01097e4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01097e7:	8d 50 ff             	lea    -0x1(%eax),%edx
c01097ea:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01097ed:	01 c2                	add    %eax,%edx
c01097ef:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01097f2:	8d 48 ff             	lea    -0x1(%eax),%ecx
c01097f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01097f8:	8d 1c 01             	lea    (%ecx,%eax,1),%ebx
    asm volatile (
c01097fb:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01097fe:	89 c1                	mov    %eax,%ecx
c0109800:	89 d8                	mov    %ebx,%eax
c0109802:	89 d6                	mov    %edx,%esi
c0109804:	89 c7                	mov    %eax,%edi
c0109806:	fd                   	std    
c0109807:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c0109809:	fc                   	cld    
c010980a:	89 f8                	mov    %edi,%eax
c010980c:	89 f2                	mov    %esi,%edx
c010980e:	89 4d cc             	mov    %ecx,-0x34(%ebp)
c0109811:	89 55 c8             	mov    %edx,-0x38(%ebp)
c0109814:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    return dst;
c0109817:	8b 45 f0             	mov    -0x10(%ebp),%eax
            *d ++ = *s ++;
        }
    }
    return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
c010981a:	83 c4 30             	add    $0x30,%esp
c010981d:	5b                   	pop    %ebx
c010981e:	5e                   	pop    %esi
c010981f:	5f                   	pop    %edi
c0109820:	5d                   	pop    %ebp
c0109821:	c3                   	ret    

c0109822 <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
c0109822:	f3 0f 1e fb          	endbr32 
c0109826:	55                   	push   %ebp
c0109827:	89 e5                	mov    %esp,%ebp
c0109829:	57                   	push   %edi
c010982a:	56                   	push   %esi
c010982b:	83 ec 20             	sub    $0x20,%esp
c010982e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109831:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109834:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109837:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010983a:	8b 45 10             	mov    0x10(%ebp),%eax
c010983d:	89 45 ec             	mov    %eax,-0x14(%ebp)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c0109840:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109843:	c1 e8 02             	shr    $0x2,%eax
c0109846:	89 c1                	mov    %eax,%ecx
    asm volatile (
c0109848:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010984b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010984e:	89 d7                	mov    %edx,%edi
c0109850:	89 c6                	mov    %eax,%esi
c0109852:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c0109854:	8b 4d ec             	mov    -0x14(%ebp),%ecx
c0109857:	83 e1 03             	and    $0x3,%ecx
c010985a:	74 02                	je     c010985e <memcpy+0x3c>
c010985c:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c010985e:	89 f0                	mov    %esi,%eax
c0109860:	89 fa                	mov    %edi,%edx
c0109862:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c0109865:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0109868:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return dst;
c010986b:	8b 45 f4             	mov    -0xc(%ebp),%eax
    while (n -- > 0) {
        *d ++ = *s ++;
    }
    return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
c010986e:	83 c4 20             	add    $0x20,%esp
c0109871:	5e                   	pop    %esi
c0109872:	5f                   	pop    %edi
c0109873:	5d                   	pop    %ebp
c0109874:	c3                   	ret    

c0109875 <memcmp>:
 *   match in both memory blocks has a greater value in @v1 than in @v2
 *   as if evaluated as unsigned char values;
 * - And a value less than zero indicates the opposite.
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
c0109875:	f3 0f 1e fb          	endbr32 
c0109879:	55                   	push   %ebp
c010987a:	89 e5                	mov    %esp,%ebp
c010987c:	83 ec 10             	sub    $0x10,%esp
    const char *s1 = (const char *)v1;
c010987f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109882:	89 45 fc             	mov    %eax,-0x4(%ebp)
    const char *s2 = (const char *)v2;
c0109885:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109888:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (n -- > 0) {
c010988b:	eb 2e                	jmp    c01098bb <memcmp+0x46>
        if (*s1 != *s2) {
c010988d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109890:	0f b6 10             	movzbl (%eax),%edx
c0109893:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109896:	0f b6 00             	movzbl (%eax),%eax
c0109899:	38 c2                	cmp    %al,%dl
c010989b:	74 18                	je     c01098b5 <memcmp+0x40>
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
c010989d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01098a0:	0f b6 00             	movzbl (%eax),%eax
c01098a3:	0f b6 d0             	movzbl %al,%edx
c01098a6:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01098a9:	0f b6 00             	movzbl (%eax),%eax
c01098ac:	0f b6 c0             	movzbl %al,%eax
c01098af:	29 c2                	sub    %eax,%edx
c01098b1:	89 d0                	mov    %edx,%eax
c01098b3:	eb 18                	jmp    c01098cd <memcmp+0x58>
        }
        s1 ++, s2 ++;
c01098b5:	ff 45 fc             	incl   -0x4(%ebp)
c01098b8:	ff 45 f8             	incl   -0x8(%ebp)
    while (n -- > 0) {
c01098bb:	8b 45 10             	mov    0x10(%ebp),%eax
c01098be:	8d 50 ff             	lea    -0x1(%eax),%edx
c01098c1:	89 55 10             	mov    %edx,0x10(%ebp)
c01098c4:	85 c0                	test   %eax,%eax
c01098c6:	75 c5                	jne    c010988d <memcmp+0x18>
    }
    return 0;
c01098c8:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01098cd:	c9                   	leave  
c01098ce:	c3                   	ret    

c01098cf <printnum>:
 * @width:      maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:       character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
c01098cf:	f3 0f 1e fb          	endbr32 
c01098d3:	55                   	push   %ebp
c01098d4:	89 e5                	mov    %esp,%ebp
c01098d6:	83 ec 58             	sub    $0x58,%esp
c01098d9:	8b 45 10             	mov    0x10(%ebp),%eax
c01098dc:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01098df:	8b 45 14             	mov    0x14(%ebp),%eax
c01098e2:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    unsigned long long result = num;
c01098e5:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01098e8:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01098eb:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01098ee:	89 55 ec             	mov    %edx,-0x14(%ebp)
    unsigned mod = do_div(result, base);
c01098f1:	8b 45 18             	mov    0x18(%ebp),%eax
c01098f4:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01098f7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01098fa:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01098fd:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0109900:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0109903:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109906:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109909:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010990d:	74 1c                	je     c010992b <printnum+0x5c>
c010990f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109912:	ba 00 00 00 00       	mov    $0x0,%edx
c0109917:	f7 75 e4             	divl   -0x1c(%ebp)
c010991a:	89 55 f4             	mov    %edx,-0xc(%ebp)
c010991d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109920:	ba 00 00 00 00       	mov    $0x0,%edx
c0109925:	f7 75 e4             	divl   -0x1c(%ebp)
c0109928:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010992b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010992e:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109931:	f7 75 e4             	divl   -0x1c(%ebp)
c0109934:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0109937:	89 55 dc             	mov    %edx,-0x24(%ebp)
c010993a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010993d:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0109940:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109943:	89 55 ec             	mov    %edx,-0x14(%ebp)
c0109946:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109949:	89 45 d8             	mov    %eax,-0x28(%ebp)

    // first recursively print all preceding (more significant) digits
    if (num >= base) {
c010994c:	8b 45 18             	mov    0x18(%ebp),%eax
c010994f:	ba 00 00 00 00       	mov    $0x0,%edx
c0109954:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c0109957:	39 45 d0             	cmp    %eax,-0x30(%ebp)
c010995a:	19 d1                	sbb    %edx,%ecx
c010995c:	72 4c                	jb     c01099aa <printnum+0xdb>
        printnum(putch, putdat, result, base, width - 1, padc);
c010995e:	8b 45 1c             	mov    0x1c(%ebp),%eax
c0109961:	8d 50 ff             	lea    -0x1(%eax),%edx
c0109964:	8b 45 20             	mov    0x20(%ebp),%eax
c0109967:	89 44 24 18          	mov    %eax,0x18(%esp)
c010996b:	89 54 24 14          	mov    %edx,0x14(%esp)
c010996f:	8b 45 18             	mov    0x18(%ebp),%eax
c0109972:	89 44 24 10          	mov    %eax,0x10(%esp)
c0109976:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109979:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010997c:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109980:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0109984:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109987:	89 44 24 04          	mov    %eax,0x4(%esp)
c010998b:	8b 45 08             	mov    0x8(%ebp),%eax
c010998e:	89 04 24             	mov    %eax,(%esp)
c0109991:	e8 39 ff ff ff       	call   c01098cf <printnum>
c0109996:	eb 1b                	jmp    c01099b3 <printnum+0xe4>
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
            putch(padc, putdat);
c0109998:	8b 45 0c             	mov    0xc(%ebp),%eax
c010999b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010999f:	8b 45 20             	mov    0x20(%ebp),%eax
c01099a2:	89 04 24             	mov    %eax,(%esp)
c01099a5:	8b 45 08             	mov    0x8(%ebp),%eax
c01099a8:	ff d0                	call   *%eax
        while (-- width > 0)
c01099aa:	ff 4d 1c             	decl   0x1c(%ebp)
c01099ad:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c01099b1:	7f e5                	jg     c0109998 <printnum+0xc9>
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat);
c01099b3:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01099b6:	05 e8 c1 10 c0       	add    $0xc010c1e8,%eax
c01099bb:	0f b6 00             	movzbl (%eax),%eax
c01099be:	0f be c0             	movsbl %al,%eax
c01099c1:	8b 55 0c             	mov    0xc(%ebp),%edx
c01099c4:	89 54 24 04          	mov    %edx,0x4(%esp)
c01099c8:	89 04 24             	mov    %eax,(%esp)
c01099cb:	8b 45 08             	mov    0x8(%ebp),%eax
c01099ce:	ff d0                	call   *%eax
}
c01099d0:	90                   	nop
c01099d1:	c9                   	leave  
c01099d2:	c3                   	ret    

c01099d3 <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
c01099d3:	f3 0f 1e fb          	endbr32 
c01099d7:	55                   	push   %ebp
c01099d8:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c01099da:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c01099de:	7e 14                	jle    c01099f4 <getuint+0x21>
        return va_arg(*ap, unsigned long long);
c01099e0:	8b 45 08             	mov    0x8(%ebp),%eax
c01099e3:	8b 00                	mov    (%eax),%eax
c01099e5:	8d 48 08             	lea    0x8(%eax),%ecx
c01099e8:	8b 55 08             	mov    0x8(%ebp),%edx
c01099eb:	89 0a                	mov    %ecx,(%edx)
c01099ed:	8b 50 04             	mov    0x4(%eax),%edx
c01099f0:	8b 00                	mov    (%eax),%eax
c01099f2:	eb 30                	jmp    c0109a24 <getuint+0x51>
    }
    else if (lflag) {
c01099f4:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01099f8:	74 16                	je     c0109a10 <getuint+0x3d>
        return va_arg(*ap, unsigned long);
c01099fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01099fd:	8b 00                	mov    (%eax),%eax
c01099ff:	8d 48 04             	lea    0x4(%eax),%ecx
c0109a02:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a05:	89 0a                	mov    %ecx,(%edx)
c0109a07:	8b 00                	mov    (%eax),%eax
c0109a09:	ba 00 00 00 00       	mov    $0x0,%edx
c0109a0e:	eb 14                	jmp    c0109a24 <getuint+0x51>
    }
    else {
        return va_arg(*ap, unsigned int);
c0109a10:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a13:	8b 00                	mov    (%eax),%eax
c0109a15:	8d 48 04             	lea    0x4(%eax),%ecx
c0109a18:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a1b:	89 0a                	mov    %ecx,(%edx)
c0109a1d:	8b 00                	mov    (%eax),%eax
c0109a1f:	ba 00 00 00 00       	mov    $0x0,%edx
    }
}
c0109a24:	5d                   	pop    %ebp
c0109a25:	c3                   	ret    

c0109a26 <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
c0109a26:	f3 0f 1e fb          	endbr32 
c0109a2a:	55                   	push   %ebp
c0109a2b:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c0109a2d:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c0109a31:	7e 14                	jle    c0109a47 <getint+0x21>
        return va_arg(*ap, long long);
c0109a33:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a36:	8b 00                	mov    (%eax),%eax
c0109a38:	8d 48 08             	lea    0x8(%eax),%ecx
c0109a3b:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a3e:	89 0a                	mov    %ecx,(%edx)
c0109a40:	8b 50 04             	mov    0x4(%eax),%edx
c0109a43:	8b 00                	mov    (%eax),%eax
c0109a45:	eb 28                	jmp    c0109a6f <getint+0x49>
    }
    else if (lflag) {
c0109a47:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0109a4b:	74 12                	je     c0109a5f <getint+0x39>
        return va_arg(*ap, long);
c0109a4d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a50:	8b 00                	mov    (%eax),%eax
c0109a52:	8d 48 04             	lea    0x4(%eax),%ecx
c0109a55:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a58:	89 0a                	mov    %ecx,(%edx)
c0109a5a:	8b 00                	mov    (%eax),%eax
c0109a5c:	99                   	cltd   
c0109a5d:	eb 10                	jmp    c0109a6f <getint+0x49>
    }
    else {
        return va_arg(*ap, int);
c0109a5f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a62:	8b 00                	mov    (%eax),%eax
c0109a64:	8d 48 04             	lea    0x4(%eax),%ecx
c0109a67:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a6a:	89 0a                	mov    %ecx,(%edx)
c0109a6c:	8b 00                	mov    (%eax),%eax
c0109a6e:	99                   	cltd   
    }
}
c0109a6f:	5d                   	pop    %ebp
c0109a70:	c3                   	ret    

c0109a71 <printfmt>:
 * @putch:      specified putch function, print a single character
 * @putdat:     used by @putch function
 * @fmt:        the format string to use
 * */
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
c0109a71:	f3 0f 1e fb          	endbr32 
c0109a75:	55                   	push   %ebp
c0109a76:	89 e5                	mov    %esp,%ebp
c0109a78:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
c0109a7b:	8d 45 14             	lea    0x14(%ebp),%eax
c0109a7e:	89 45 f4             	mov    %eax,-0xc(%ebp)
    vprintfmt(putch, putdat, fmt, ap);
c0109a81:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109a84:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109a88:	8b 45 10             	mov    0x10(%ebp),%eax
c0109a8b:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109a8f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109a92:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109a96:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a99:	89 04 24             	mov    %eax,(%esp)
c0109a9c:	e8 03 00 00 00       	call   c0109aa4 <vprintfmt>
    va_end(ap);
}
c0109aa1:	90                   	nop
c0109aa2:	c9                   	leave  
c0109aa3:	c3                   	ret    

c0109aa4 <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
c0109aa4:	f3 0f 1e fb          	endbr32 
c0109aa8:	55                   	push   %ebp
c0109aa9:	89 e5                	mov    %esp,%ebp
c0109aab:	56                   	push   %esi
c0109aac:	53                   	push   %ebx
c0109aad:	83 ec 40             	sub    $0x40,%esp
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c0109ab0:	eb 17                	jmp    c0109ac9 <vprintfmt+0x25>
            if (ch == '\0') {
c0109ab2:	85 db                	test   %ebx,%ebx
c0109ab4:	0f 84 c0 03 00 00    	je     c0109e7a <vprintfmt+0x3d6>
                return;
            }
            putch(ch, putdat);
c0109aba:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109abd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109ac1:	89 1c 24             	mov    %ebx,(%esp)
c0109ac4:	8b 45 08             	mov    0x8(%ebp),%eax
c0109ac7:	ff d0                	call   *%eax
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c0109ac9:	8b 45 10             	mov    0x10(%ebp),%eax
c0109acc:	8d 50 01             	lea    0x1(%eax),%edx
c0109acf:	89 55 10             	mov    %edx,0x10(%ebp)
c0109ad2:	0f b6 00             	movzbl (%eax),%eax
c0109ad5:	0f b6 d8             	movzbl %al,%ebx
c0109ad8:	83 fb 25             	cmp    $0x25,%ebx
c0109adb:	75 d5                	jne    c0109ab2 <vprintfmt+0xe>
        }

        // Process a %-escape sequence
        char padc = ' ';
c0109add:	c6 45 db 20          	movb   $0x20,-0x25(%ebp)
        width = precision = -1;
c0109ae1:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
c0109ae8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109aeb:	89 45 e8             	mov    %eax,-0x18(%ebp)
        lflag = altflag = 0;
c0109aee:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0109af5:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109af8:	89 45 e0             	mov    %eax,-0x20(%ebp)

    reswitch:
        switch (ch = *(unsigned char *)fmt ++) {
c0109afb:	8b 45 10             	mov    0x10(%ebp),%eax
c0109afe:	8d 50 01             	lea    0x1(%eax),%edx
c0109b01:	89 55 10             	mov    %edx,0x10(%ebp)
c0109b04:	0f b6 00             	movzbl (%eax),%eax
c0109b07:	0f b6 d8             	movzbl %al,%ebx
c0109b0a:	8d 43 dd             	lea    -0x23(%ebx),%eax
c0109b0d:	83 f8 55             	cmp    $0x55,%eax
c0109b10:	0f 87 38 03 00 00    	ja     c0109e4e <vprintfmt+0x3aa>
c0109b16:	8b 04 85 0c c2 10 c0 	mov    -0x3fef3df4(,%eax,4),%eax
c0109b1d:	3e ff e0             	notrack jmp *%eax

        // flag to pad on the right
        case '-':
            padc = '-';
c0109b20:	c6 45 db 2d          	movb   $0x2d,-0x25(%ebp)
            goto reswitch;
c0109b24:	eb d5                	jmp    c0109afb <vprintfmt+0x57>

        // flag to pad with 0's instead of spaces
        case '0':
            padc = '0';
c0109b26:	c6 45 db 30          	movb   $0x30,-0x25(%ebp)
            goto reswitch;
c0109b2a:	eb cf                	jmp    c0109afb <vprintfmt+0x57>

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c0109b2c:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
                precision = precision * 10 + ch - '0';
c0109b33:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109b36:	89 d0                	mov    %edx,%eax
c0109b38:	c1 e0 02             	shl    $0x2,%eax
c0109b3b:	01 d0                	add    %edx,%eax
c0109b3d:	01 c0                	add    %eax,%eax
c0109b3f:	01 d8                	add    %ebx,%eax
c0109b41:	83 e8 30             	sub    $0x30,%eax
c0109b44:	89 45 e4             	mov    %eax,-0x1c(%ebp)
                ch = *fmt;
c0109b47:	8b 45 10             	mov    0x10(%ebp),%eax
c0109b4a:	0f b6 00             	movzbl (%eax),%eax
c0109b4d:	0f be d8             	movsbl %al,%ebx
                if (ch < '0' || ch > '9') {
c0109b50:	83 fb 2f             	cmp    $0x2f,%ebx
c0109b53:	7e 38                	jle    c0109b8d <vprintfmt+0xe9>
c0109b55:	83 fb 39             	cmp    $0x39,%ebx
c0109b58:	7f 33                	jg     c0109b8d <vprintfmt+0xe9>
            for (precision = 0; ; ++ fmt) {
c0109b5a:	ff 45 10             	incl   0x10(%ebp)
                precision = precision * 10 + ch - '0';
c0109b5d:	eb d4                	jmp    c0109b33 <vprintfmt+0x8f>
                }
            }
            goto process_precision;

        case '*':
            precision = va_arg(ap, int);
c0109b5f:	8b 45 14             	mov    0x14(%ebp),%eax
c0109b62:	8d 50 04             	lea    0x4(%eax),%edx
c0109b65:	89 55 14             	mov    %edx,0x14(%ebp)
c0109b68:	8b 00                	mov    (%eax),%eax
c0109b6a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            goto process_precision;
c0109b6d:	eb 1f                	jmp    c0109b8e <vprintfmt+0xea>

        case '.':
            if (width < 0)
c0109b6f:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109b73:	79 86                	jns    c0109afb <vprintfmt+0x57>
                width = 0;
c0109b75:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
            goto reswitch;
c0109b7c:	e9 7a ff ff ff       	jmp    c0109afb <vprintfmt+0x57>

        case '#':
            altflag = 1;
c0109b81:	c7 45 dc 01 00 00 00 	movl   $0x1,-0x24(%ebp)
            goto reswitch;
c0109b88:	e9 6e ff ff ff       	jmp    c0109afb <vprintfmt+0x57>
            goto process_precision;
c0109b8d:	90                   	nop

        process_precision:
            if (width < 0)
c0109b8e:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109b92:	0f 89 63 ff ff ff    	jns    c0109afb <vprintfmt+0x57>
                width = precision, precision = -1;
c0109b98:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109b9b:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109b9e:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
            goto reswitch;
c0109ba5:	e9 51 ff ff ff       	jmp    c0109afb <vprintfmt+0x57>

        // long flag (doubled for long long)
        case 'l':
            lflag ++;
c0109baa:	ff 45 e0             	incl   -0x20(%ebp)
            goto reswitch;
c0109bad:	e9 49 ff ff ff       	jmp    c0109afb <vprintfmt+0x57>

        // character
        case 'c':
            putch(va_arg(ap, int), putdat);
c0109bb2:	8b 45 14             	mov    0x14(%ebp),%eax
c0109bb5:	8d 50 04             	lea    0x4(%eax),%edx
c0109bb8:	89 55 14             	mov    %edx,0x14(%ebp)
c0109bbb:	8b 00                	mov    (%eax),%eax
c0109bbd:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109bc0:	89 54 24 04          	mov    %edx,0x4(%esp)
c0109bc4:	89 04 24             	mov    %eax,(%esp)
c0109bc7:	8b 45 08             	mov    0x8(%ebp),%eax
c0109bca:	ff d0                	call   *%eax
            break;
c0109bcc:	e9 a4 02 00 00       	jmp    c0109e75 <vprintfmt+0x3d1>

        // error message
        case 'e':
            err = va_arg(ap, int);
c0109bd1:	8b 45 14             	mov    0x14(%ebp),%eax
c0109bd4:	8d 50 04             	lea    0x4(%eax),%edx
c0109bd7:	89 55 14             	mov    %edx,0x14(%ebp)
c0109bda:	8b 18                	mov    (%eax),%ebx
            if (err < 0) {
c0109bdc:	85 db                	test   %ebx,%ebx
c0109bde:	79 02                	jns    c0109be2 <vprintfmt+0x13e>
                err = -err;
c0109be0:	f7 db                	neg    %ebx
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
c0109be2:	83 fb 06             	cmp    $0x6,%ebx
c0109be5:	7f 0b                	jg     c0109bf2 <vprintfmt+0x14e>
c0109be7:	8b 34 9d cc c1 10 c0 	mov    -0x3fef3e34(,%ebx,4),%esi
c0109bee:	85 f6                	test   %esi,%esi
c0109bf0:	75 23                	jne    c0109c15 <vprintfmt+0x171>
                printfmt(putch, putdat, "error %d", err);
c0109bf2:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c0109bf6:	c7 44 24 08 f9 c1 10 	movl   $0xc010c1f9,0x8(%esp)
c0109bfd:	c0 
c0109bfe:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109c01:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109c05:	8b 45 08             	mov    0x8(%ebp),%eax
c0109c08:	89 04 24             	mov    %eax,(%esp)
c0109c0b:	e8 61 fe ff ff       	call   c0109a71 <printfmt>
            }
            else {
                printfmt(putch, putdat, "%s", p);
            }
            break;
c0109c10:	e9 60 02 00 00       	jmp    c0109e75 <vprintfmt+0x3d1>
                printfmt(putch, putdat, "%s", p);
c0109c15:	89 74 24 0c          	mov    %esi,0xc(%esp)
c0109c19:	c7 44 24 08 02 c2 10 	movl   $0xc010c202,0x8(%esp)
c0109c20:	c0 
c0109c21:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109c24:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109c28:	8b 45 08             	mov    0x8(%ebp),%eax
c0109c2b:	89 04 24             	mov    %eax,(%esp)
c0109c2e:	e8 3e fe ff ff       	call   c0109a71 <printfmt>
            break;
c0109c33:	e9 3d 02 00 00       	jmp    c0109e75 <vprintfmt+0x3d1>

        // string
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
c0109c38:	8b 45 14             	mov    0x14(%ebp),%eax
c0109c3b:	8d 50 04             	lea    0x4(%eax),%edx
c0109c3e:	89 55 14             	mov    %edx,0x14(%ebp)
c0109c41:	8b 30                	mov    (%eax),%esi
c0109c43:	85 f6                	test   %esi,%esi
c0109c45:	75 05                	jne    c0109c4c <vprintfmt+0x1a8>
                p = "(null)";
c0109c47:	be 05 c2 10 c0       	mov    $0xc010c205,%esi
            }
            if (width > 0 && padc != '-') {
c0109c4c:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109c50:	7e 76                	jle    c0109cc8 <vprintfmt+0x224>
c0109c52:	80 7d db 2d          	cmpb   $0x2d,-0x25(%ebp)
c0109c56:	74 70                	je     c0109cc8 <vprintfmt+0x224>
                for (width -= strnlen(p, precision); width > 0; width --) {
c0109c58:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109c5b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109c5f:	89 34 24             	mov    %esi,(%esp)
c0109c62:	e8 ba f7 ff ff       	call   c0109421 <strnlen>
c0109c67:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0109c6a:	29 c2                	sub    %eax,%edx
c0109c6c:	89 d0                	mov    %edx,%eax
c0109c6e:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109c71:	eb 16                	jmp    c0109c89 <vprintfmt+0x1e5>
                    putch(padc, putdat);
c0109c73:	0f be 45 db          	movsbl -0x25(%ebp),%eax
c0109c77:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109c7a:	89 54 24 04          	mov    %edx,0x4(%esp)
c0109c7e:	89 04 24             	mov    %eax,(%esp)
c0109c81:	8b 45 08             	mov    0x8(%ebp),%eax
c0109c84:	ff d0                	call   *%eax
                for (width -= strnlen(p, precision); width > 0; width --) {
c0109c86:	ff 4d e8             	decl   -0x18(%ebp)
c0109c89:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109c8d:	7f e4                	jg     c0109c73 <vprintfmt+0x1cf>
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c0109c8f:	eb 37                	jmp    c0109cc8 <vprintfmt+0x224>
                if (altflag && (ch < ' ' || ch > '~')) {
c0109c91:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0109c95:	74 1f                	je     c0109cb6 <vprintfmt+0x212>
c0109c97:	83 fb 1f             	cmp    $0x1f,%ebx
c0109c9a:	7e 05                	jle    c0109ca1 <vprintfmt+0x1fd>
c0109c9c:	83 fb 7e             	cmp    $0x7e,%ebx
c0109c9f:	7e 15                	jle    c0109cb6 <vprintfmt+0x212>
                    putch('?', putdat);
c0109ca1:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109ca4:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109ca8:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
c0109caf:	8b 45 08             	mov    0x8(%ebp),%eax
c0109cb2:	ff d0                	call   *%eax
c0109cb4:	eb 0f                	jmp    c0109cc5 <vprintfmt+0x221>
                }
                else {
                    putch(ch, putdat);
c0109cb6:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109cb9:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109cbd:	89 1c 24             	mov    %ebx,(%esp)
c0109cc0:	8b 45 08             	mov    0x8(%ebp),%eax
c0109cc3:	ff d0                	call   *%eax
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c0109cc5:	ff 4d e8             	decl   -0x18(%ebp)
c0109cc8:	89 f0                	mov    %esi,%eax
c0109cca:	8d 70 01             	lea    0x1(%eax),%esi
c0109ccd:	0f b6 00             	movzbl (%eax),%eax
c0109cd0:	0f be d8             	movsbl %al,%ebx
c0109cd3:	85 db                	test   %ebx,%ebx
c0109cd5:	74 27                	je     c0109cfe <vprintfmt+0x25a>
c0109cd7:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0109cdb:	78 b4                	js     c0109c91 <vprintfmt+0x1ed>
c0109cdd:	ff 4d e4             	decl   -0x1c(%ebp)
c0109ce0:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0109ce4:	79 ab                	jns    c0109c91 <vprintfmt+0x1ed>
                }
            }
            for (; width > 0; width --) {
c0109ce6:	eb 16                	jmp    c0109cfe <vprintfmt+0x25a>
                putch(' ', putdat);
c0109ce8:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109ceb:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109cef:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0109cf6:	8b 45 08             	mov    0x8(%ebp),%eax
c0109cf9:	ff d0                	call   *%eax
            for (; width > 0; width --) {
c0109cfb:	ff 4d e8             	decl   -0x18(%ebp)
c0109cfe:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109d02:	7f e4                	jg     c0109ce8 <vprintfmt+0x244>
            }
            break;
c0109d04:	e9 6c 01 00 00       	jmp    c0109e75 <vprintfmt+0x3d1>

        // (signed) decimal
        case 'd':
            num = getint(&ap, lflag);
c0109d09:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109d0c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d10:	8d 45 14             	lea    0x14(%ebp),%eax
c0109d13:	89 04 24             	mov    %eax,(%esp)
c0109d16:	e8 0b fd ff ff       	call   c0109a26 <getint>
c0109d1b:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109d1e:	89 55 f4             	mov    %edx,-0xc(%ebp)
            if ((long long)num < 0) {
c0109d21:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109d24:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109d27:	85 d2                	test   %edx,%edx
c0109d29:	79 26                	jns    c0109d51 <vprintfmt+0x2ad>
                putch('-', putdat);
c0109d2b:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109d2e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d32:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
c0109d39:	8b 45 08             	mov    0x8(%ebp),%eax
c0109d3c:	ff d0                	call   *%eax
                num = -(long long)num;
c0109d3e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109d41:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109d44:	f7 d8                	neg    %eax
c0109d46:	83 d2 00             	adc    $0x0,%edx
c0109d49:	f7 da                	neg    %edx
c0109d4b:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109d4e:	89 55 f4             	mov    %edx,-0xc(%ebp)
            }
            base = 10;
c0109d51:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c0109d58:	e9 a8 00 00 00       	jmp    c0109e05 <vprintfmt+0x361>

        // unsigned decimal
        case 'u':
            num = getuint(&ap, lflag);
c0109d5d:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109d60:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d64:	8d 45 14             	lea    0x14(%ebp),%eax
c0109d67:	89 04 24             	mov    %eax,(%esp)
c0109d6a:	e8 64 fc ff ff       	call   c01099d3 <getuint>
c0109d6f:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109d72:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 10;
c0109d75:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c0109d7c:	e9 84 00 00 00       	jmp    c0109e05 <vprintfmt+0x361>

        // (unsigned) octal
        case 'o':
            num = getuint(&ap, lflag);
c0109d81:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109d84:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d88:	8d 45 14             	lea    0x14(%ebp),%eax
c0109d8b:	89 04 24             	mov    %eax,(%esp)
c0109d8e:	e8 40 fc ff ff       	call   c01099d3 <getuint>
c0109d93:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109d96:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 8;
c0109d99:	c7 45 ec 08 00 00 00 	movl   $0x8,-0x14(%ebp)
            goto number;
c0109da0:	eb 63                	jmp    c0109e05 <vprintfmt+0x361>

        // pointer
        case 'p':
            putch('0', putdat);
c0109da2:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109da5:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109da9:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
c0109db0:	8b 45 08             	mov    0x8(%ebp),%eax
c0109db3:	ff d0                	call   *%eax
            putch('x', putdat);
c0109db5:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109db8:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109dbc:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
c0109dc3:	8b 45 08             	mov    0x8(%ebp),%eax
c0109dc6:	ff d0                	call   *%eax
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
c0109dc8:	8b 45 14             	mov    0x14(%ebp),%eax
c0109dcb:	8d 50 04             	lea    0x4(%eax),%edx
c0109dce:	89 55 14             	mov    %edx,0x14(%ebp)
c0109dd1:	8b 00                	mov    (%eax),%eax
c0109dd3:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109dd6:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
            base = 16;
c0109ddd:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
            goto number;
c0109de4:	eb 1f                	jmp    c0109e05 <vprintfmt+0x361>

        // (unsigned) hexadecimal
        case 'x':
            num = getuint(&ap, lflag);
c0109de6:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109de9:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109ded:	8d 45 14             	lea    0x14(%ebp),%eax
c0109df0:	89 04 24             	mov    %eax,(%esp)
c0109df3:	e8 db fb ff ff       	call   c01099d3 <getuint>
c0109df8:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109dfb:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 16;
c0109dfe:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
        number:
            printnum(putch, putdat, num, base, width, padc);
c0109e05:	0f be 55 db          	movsbl -0x25(%ebp),%edx
c0109e09:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109e0c:	89 54 24 18          	mov    %edx,0x18(%esp)
c0109e10:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0109e13:	89 54 24 14          	mov    %edx,0x14(%esp)
c0109e17:	89 44 24 10          	mov    %eax,0x10(%esp)
c0109e1b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109e1e:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109e21:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109e25:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0109e29:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e2c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109e30:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e33:	89 04 24             	mov    %eax,(%esp)
c0109e36:	e8 94 fa ff ff       	call   c01098cf <printnum>
            break;
c0109e3b:	eb 38                	jmp    c0109e75 <vprintfmt+0x3d1>

        // escaped '%' character
        case '%':
            putch(ch, putdat);
c0109e3d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e40:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109e44:	89 1c 24             	mov    %ebx,(%esp)
c0109e47:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e4a:	ff d0                	call   *%eax
            break;
c0109e4c:	eb 27                	jmp    c0109e75 <vprintfmt+0x3d1>

        // unrecognized escape sequence - just print it literally
        default:
            putch('%', putdat);
c0109e4e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e51:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109e55:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
c0109e5c:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e5f:	ff d0                	call   *%eax
            for (fmt --; fmt[-1] != '%'; fmt --)
c0109e61:	ff 4d 10             	decl   0x10(%ebp)
c0109e64:	eb 03                	jmp    c0109e69 <vprintfmt+0x3c5>
c0109e66:	ff 4d 10             	decl   0x10(%ebp)
c0109e69:	8b 45 10             	mov    0x10(%ebp),%eax
c0109e6c:	48                   	dec    %eax
c0109e6d:	0f b6 00             	movzbl (%eax),%eax
c0109e70:	3c 25                	cmp    $0x25,%al
c0109e72:	75 f2                	jne    c0109e66 <vprintfmt+0x3c2>
                /* do nothing */;
            break;
c0109e74:	90                   	nop
    while (1) {
c0109e75:	e9 36 fc ff ff       	jmp    c0109ab0 <vprintfmt+0xc>
                return;
c0109e7a:	90                   	nop
        }
    }
}
c0109e7b:	83 c4 40             	add    $0x40,%esp
c0109e7e:	5b                   	pop    %ebx
c0109e7f:	5e                   	pop    %esi
c0109e80:	5d                   	pop    %ebp
c0109e81:	c3                   	ret    

c0109e82 <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:         the character will be printed
 * @b:          the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
c0109e82:	f3 0f 1e fb          	endbr32 
c0109e86:	55                   	push   %ebp
c0109e87:	89 e5                	mov    %esp,%ebp
    b->cnt ++;
c0109e89:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e8c:	8b 40 08             	mov    0x8(%eax),%eax
c0109e8f:	8d 50 01             	lea    0x1(%eax),%edx
c0109e92:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e95:	89 50 08             	mov    %edx,0x8(%eax)
    if (b->buf < b->ebuf) {
c0109e98:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e9b:	8b 10                	mov    (%eax),%edx
c0109e9d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109ea0:	8b 40 04             	mov    0x4(%eax),%eax
c0109ea3:	39 c2                	cmp    %eax,%edx
c0109ea5:	73 12                	jae    c0109eb9 <sprintputch+0x37>
        *b->buf ++ = ch;
c0109ea7:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109eaa:	8b 00                	mov    (%eax),%eax
c0109eac:	8d 48 01             	lea    0x1(%eax),%ecx
c0109eaf:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109eb2:	89 0a                	mov    %ecx,(%edx)
c0109eb4:	8b 55 08             	mov    0x8(%ebp),%edx
c0109eb7:	88 10                	mov    %dl,(%eax)
    }
}
c0109eb9:	90                   	nop
c0109eba:	5d                   	pop    %ebp
c0109ebb:	c3                   	ret    

c0109ebc <snprintf>:
 * @str:        the buffer to place the result into
 * @size:       the size of buffer, including the trailing null space
 * @fmt:        the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
c0109ebc:	f3 0f 1e fb          	endbr32 
c0109ec0:	55                   	push   %ebp
c0109ec1:	89 e5                	mov    %esp,%ebp
c0109ec3:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c0109ec6:	8d 45 14             	lea    0x14(%ebp),%eax
c0109ec9:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vsnprintf(str, size, fmt, ap);
c0109ecc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109ecf:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109ed3:	8b 45 10             	mov    0x10(%ebp),%eax
c0109ed6:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109eda:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109edd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109ee1:	8b 45 08             	mov    0x8(%ebp),%eax
c0109ee4:	89 04 24             	mov    %eax,(%esp)
c0109ee7:	e8 08 00 00 00       	call   c0109ef4 <vsnprintf>
c0109eec:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c0109eef:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0109ef2:	c9                   	leave  
c0109ef3:	c3                   	ret    

c0109ef4 <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
c0109ef4:	f3 0f 1e fb          	endbr32 
c0109ef8:	55                   	push   %ebp
c0109ef9:	89 e5                	mov    %esp,%ebp
c0109efb:	83 ec 28             	sub    $0x28,%esp
    struct sprintbuf b = {str, str + size - 1, 0};
c0109efe:	8b 45 08             	mov    0x8(%ebp),%eax
c0109f01:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109f04:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109f07:	8d 50 ff             	lea    -0x1(%eax),%edx
c0109f0a:	8b 45 08             	mov    0x8(%ebp),%eax
c0109f0d:	01 d0                	add    %edx,%eax
c0109f0f:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109f12:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if (str == NULL || b.buf > b.ebuf) {
c0109f19:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0109f1d:	74 0a                	je     c0109f29 <vsnprintf+0x35>
c0109f1f:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109f22:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109f25:	39 c2                	cmp    %eax,%edx
c0109f27:	76 07                	jbe    c0109f30 <vsnprintf+0x3c>
        return -E_INVAL;
c0109f29:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c0109f2e:	eb 2a                	jmp    c0109f5a <vsnprintf+0x66>
    }
    // print the string to the buffer
    vprintfmt((void*)sprintputch, &b, fmt, ap);
c0109f30:	8b 45 14             	mov    0x14(%ebp),%eax
c0109f33:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109f37:	8b 45 10             	mov    0x10(%ebp),%eax
c0109f3a:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109f3e:	8d 45 ec             	lea    -0x14(%ebp),%eax
c0109f41:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109f45:	c7 04 24 82 9e 10 c0 	movl   $0xc0109e82,(%esp)
c0109f4c:	e8 53 fb ff ff       	call   c0109aa4 <vprintfmt>
    // null terminate the buffer
    *b.buf = '\0';
c0109f51:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109f54:	c6 00 00             	movb   $0x0,(%eax)
    return b.cnt;
c0109f57:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0109f5a:	c9                   	leave  
c0109f5b:	c3                   	ret    

c0109f5c <hash32>:
 * @bits:   the number of bits in a return value
 *
 * High bits are more random, so we use them.
 * */
uint32_t
hash32(uint32_t val, unsigned int bits) {
c0109f5c:	f3 0f 1e fb          	endbr32 
c0109f60:	55                   	push   %ebp
c0109f61:	89 e5                	mov    %esp,%ebp
c0109f63:	83 ec 10             	sub    $0x10,%esp
    uint32_t hash = val * GOLDEN_RATIO_PRIME_32;
c0109f66:	8b 45 08             	mov    0x8(%ebp),%eax
c0109f69:	69 c0 01 00 37 9e    	imul   $0x9e370001,%eax,%eax
c0109f6f:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (hash >> (32 - bits));
c0109f72:	b8 20 00 00 00       	mov    $0x20,%eax
c0109f77:	2b 45 0c             	sub    0xc(%ebp),%eax
c0109f7a:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0109f7d:	88 c1                	mov    %al,%cl
c0109f7f:	d3 ea                	shr    %cl,%edx
c0109f81:	89 d0                	mov    %edx,%eax
}
c0109f83:	c9                   	leave  
c0109f84:	c3                   	ret    

c0109f85 <rand>:
 * rand - returns a pseudo-random integer
 *
 * The rand() function return a value in the range [0, RAND_MAX].
 * */
int
rand(void) {
c0109f85:	f3 0f 1e fb          	endbr32 
c0109f89:	55                   	push   %ebp
c0109f8a:	89 e5                	mov    %esp,%ebp
c0109f8c:	57                   	push   %edi
c0109f8d:	56                   	push   %esi
c0109f8e:	53                   	push   %ebx
c0109f8f:	83 ec 24             	sub    $0x24,%esp
    next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
c0109f92:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
c0109f97:	8b 15 7c 8a 12 c0    	mov    0xc0128a7c,%edx
c0109f9d:	69 fa 6d e6 ec de    	imul   $0xdeece66d,%edx,%edi
c0109fa3:	6b f0 05             	imul   $0x5,%eax,%esi
c0109fa6:	01 fe                	add    %edi,%esi
c0109fa8:	bf 6d e6 ec de       	mov    $0xdeece66d,%edi
c0109fad:	f7 e7                	mul    %edi
c0109faf:	01 d6                	add    %edx,%esi
c0109fb1:	89 f2                	mov    %esi,%edx
c0109fb3:	83 c0 0b             	add    $0xb,%eax
c0109fb6:	83 d2 00             	adc    $0x0,%edx
c0109fb9:	89 c7                	mov    %eax,%edi
c0109fbb:	83 e7 ff             	and    $0xffffffff,%edi
c0109fbe:	89 f9                	mov    %edi,%ecx
c0109fc0:	0f b7 da             	movzwl %dx,%ebx
c0109fc3:	89 0d 78 8a 12 c0    	mov    %ecx,0xc0128a78
c0109fc9:	89 1d 7c 8a 12 c0    	mov    %ebx,0xc0128a7c
    unsigned long long result = (next >> 12);
c0109fcf:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
c0109fd4:	8b 15 7c 8a 12 c0    	mov    0xc0128a7c,%edx
c0109fda:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0109fde:	c1 ea 0c             	shr    $0xc,%edx
c0109fe1:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0109fe4:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return (int)do_div(result, RAND_MAX + 1);
c0109fe7:	c7 45 dc 00 00 00 80 	movl   $0x80000000,-0x24(%ebp)
c0109fee:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109ff1:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109ff4:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0109ff7:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0109ffa:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109ffd:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010a000:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010a004:	74 1c                	je     c010a022 <rand+0x9d>
c010a006:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a009:	ba 00 00 00 00       	mov    $0x0,%edx
c010a00e:	f7 75 dc             	divl   -0x24(%ebp)
c010a011:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010a014:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a017:	ba 00 00 00 00       	mov    $0x0,%edx
c010a01c:	f7 75 dc             	divl   -0x24(%ebp)
c010a01f:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010a022:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a025:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010a028:	f7 75 dc             	divl   -0x24(%ebp)
c010a02b:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a02e:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c010a031:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a034:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010a037:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010a03a:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c010a03d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
c010a040:	83 c4 24             	add    $0x24,%esp
c010a043:	5b                   	pop    %ebx
c010a044:	5e                   	pop    %esi
c010a045:	5f                   	pop    %edi
c010a046:	5d                   	pop    %ebp
c010a047:	c3                   	ret    

c010a048 <srand>:
/* *
 * srand - seed the random number generator with the given number
 * @seed:   the required seed number
 * */
void
srand(unsigned int seed) {
c010a048:	f3 0f 1e fb          	endbr32 
c010a04c:	55                   	push   %ebp
c010a04d:	89 e5                	mov    %esp,%ebp
    next = seed;
c010a04f:	8b 45 08             	mov    0x8(%ebp),%eax
c010a052:	ba 00 00 00 00       	mov    $0x0,%edx
c010a057:	a3 78 8a 12 c0       	mov    %eax,0xc0128a78
c010a05c:	89 15 7c 8a 12 c0    	mov    %edx,0xc0128a7c
}
c010a062:	90                   	nop
c010a063:	5d                   	pop    %ebp
c010a064:	c3                   	ret    
